[][src]Function dotenv::from_path_iter

pub fn from_path_iter<P: AsRef<Path>>(path: P) -> Result<Iter<File>>
Deprecated since 0.14.1:

please use from_path in conjunction with var instead

Like from_path, but returns an iterator over variables instead of loading into environment.


use dotenv;
use std::env;
use std::path::{Path};

let my_path = env::home_dir().and_then(|a| Some(a.join("/.env"))).unwrap();
let iter = dotenv::from_path_iter(my_path.as_path()).unwrap();

for item in iter {
  let (key, val) = item.unwrap();
  println!("{}={}", key, val);