pub fn try_from_path<P: AsRef<Path>>(path: P) -> Result<Dotenv>
Expand description

Create a Dotenv instance from the given path.

Examples

use std::env;

let my_path = env::home_dir().map(|dir| dir.join(".env")).unwrap();
for item in dotenv::try_from_path(my_path.as_path()).unwrap() {
  let (key, val) = item.unwrap();
  println!("{}={}", key, val);
}