Function std::env::var_stringUnstable
[-]
[+]
[src]
pub fn var_string<K: ?Sized>(key: &K) -> Result<String, VarError> where K: AsOsStrFetches 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.
Example
fn main() { use std::env; let key = "HOME"; match env::var_string(key) { Ok(val) => println!("{}: {:?}", key, val), Err(e) => println!("couldn't interpret {}: {}", key, e), } }use std::env; let key = "HOME"; match env::var_string(key) { Ok(val) => println!("{}: {:?}", key, val), Err(e) => println!("couldn't interpret {}: {}", key, e), }