from_env

Function from_env 

Source
pub fn from_env<'de, D>() -> Result<D, Error>
where D: Deserialize<'de>,
Expand description

Deserialize from env::args().

This functions parses the command line arguments into the provided type. On success a value of type D is returned; on failure an Error is returned instead.

ยงExample

This example reads a string from the command line, returning early if an error is encountered.

fn main() {
    let value: String = match serde_args::from_env() {
        Ok(value) => value,
        Err(error) => {
            println!("{error}");
            return;
        }
    };
    // Execute your program with `value`...
}