[−][src]Function dotenv::from_filename_iter
pub fn from_filename_iter<P: AsRef<Path>>(filename: P) -> Result<Iter<File>>
Deprecated since 0.14.1:
please use from_path
in conjunction with var
instead
Like from_filename
, but returns an iterator over variables instead of loading into environment.
Examples
use dotenv; dotenv::from_filename("custom.env").ok();
It is also possible to do the following, but it is equivalent to using dotenv::dotenv()
,
which is preferred.
use dotenv; let iter = dotenv::from_filename_iter(".env").unwrap(); for item in iter { let (key, val) = item.unwrap(); println!("{}={}", key, val); }