serde-env

Crates.ioserde-env
lib.rsserde-env
version0.2.0
sourcesrc
created_at2022-04-21 02:10:07.073271
updated_at2024-08-05 08:52:40.869968
descriptiondeserialize env into structs via serde
homepage
repositoryhttps://github.com/Xuanwo/serde-env
max_upload_size
id571312
size50,013
Xuanwo (Xuanwo)

documentation

https://docs.rs/serde-env

README

serde-env   Build Status Latest Version

Deserialize env into structs via serde

Quick Start

use serde::Deserialize;
use serde_env::from_env;

#[derive(Debug, Deserialize)]
struct Cargo {
    home: String,
}

#[derive(Debug, Deserialize)]
struct Test {
    home: String,
    cargo: Cargo,
}

fn main() {
    let t: Test = from_env().expect("deserialize from env");

    assert!(!t.home.is_empty());
    assert!(!t.cargo.home.is_empty());
    println!("{:?}", t)
}

Contributing

Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.

Getting help

Submit issues for bug report or asking questions in discussion.

Acknowledgment

This project is highly inspired by envy

License

Licensed under Apache License, Version 2.0.
Commit count: 23

cargo fmt