pub fn var<K:AsRef<OsStr>>(key: K) -> Result<String, VarError> {
    match env::var_os(&key) {
        Some(s) => s.into_string().map_err(VarError::NotUnicode),
        None => Err(VarError::NotPresent(key.as_ref().to_str().unwrap().to_owned())),
    }
}
/// Fetches the environment variable `key` from the current process.
///
/// The returned result is `Ok(s)` if the environment variable is present and is
/// valid unicode. If the environment variable is not present, or it is not
/// valid unicode, then `Err` will be returned.
///
/// # Examples
///
/// ```
/// use std::env;
///
/// let key = "HOME";
/// match env::var(key) {
///     Ok(val) => println!("{}: {:?}", key, val),
///     Err(e) => println!("couldn't interpret {}: {}", key, e),
/// }
/// ```
Fetches the environment variable `key` from the current process.
The returned result is `Ok(s)` if the environment variable is present and is
valid unicode. If the environment variable is not present, or it is not
valid unicode, then `Err` will be returned.
Fetches the environment variable ` key ` from the current process . The returned result is ` Ok ( s ) ` if the environment variable is present and is valid unicode . If the environment variable is not present or it is not valid unicode then ` Err ` will be returned .
pub fn var<K:AsRef<OsStr>>(key: K) -> Result<String, VarError> {
    match env::var_os(&key) {
        Some(s) => s.into_string().map_err(VarError::NotUnicode),
        None => Err(VarError::NotPresent(key.as_ref().to_str().unwrap().to_owned())),
    }
}
pub fn var < K : AsRef < OsStr > > ( key : K ) -> Result < String , VarError > { match env :: var_os ( & key ) { Some ( s ) => s . into_string ( ) . map_err ( VarError :: NotUnicode ) , None => Err ( VarError :: NotPresent ( key . as_ref ( ) . to_str ( ) . unwrap ( ) . to_owned ( ) ) ) , } }
Fetches the environment variable `key` from the current process.
Fetches the environment variable ` key ` from the current process .
key
K
key
K
examples
None