[][src]Function dotenv::var

pub fn var<K: AsRef<OsStr>>(key: K) -> Result<String>

After loading the dotenv file, 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 dotenv;

let key = "FOO";
let value= dotenv::var(key).unwrap();