Function itconfig::get_env[][src]

pub fn get_env<T>(env_name: &str) -> Result<T, EnvError> where
    T: FromEnvString
Expand description

Try to read environment variable and parse to expected type. You may to put to argument any type with FromEnvString trait.

Example

use std::env;

fn main () {
    env::set_var("DEBUG", "true");

    let result: bool = get_env("DEBUG").unwrap();

    assert_eq!(result, true);
}