Crates.io | serde-env |
lib.rs | serde-env |
version | 0.2.0 |
source | src |
created_at | 2022-04-21 02:10:07.073271 |
updated_at | 2024-08-05 08:52:40.869968 |
description | deserialize env into structs via serde |
homepage | |
repository | https://github.com/Xuanwo/serde-env |
max_upload_size | |
id | 571312 |
size | 50,013 |
Deserialize env into structs via serde
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)
}
Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.
Submit issues for bug report or asking questions in discussion.
This project is highly inspired by envy