Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 413 Bytes

crates-io.md

File metadata and controls

19 lines (14 loc) · 413 Bytes

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:#?}");