de_env

Crates.iode_env
lib.rsde_env
version1.0.0
sourcesrc
created_at2022-05-01 13:16:17.666469
updated_at2022-05-07 11:18:22.690645
descriptionDeserialize environment variables into a struct
homepage
repositoryhttps://github.com/malobre/de_env
max_upload_size
id578588
size26,147
Maël Obréjan (malobre)

documentation

README

de_env helps you easily deserialize environment variables into a struct.

Example

Assuming we have a TIMEOUT, HOST and RETRY environment variable:

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
struct Config {
    timeout: u16,
    host: std::net::IpAddr,
    retry: bool,
}

let config: Config = de_env::from_env()?;

println!("{config:#?}");
Commit count: 45

cargo fmt