envfile

Crates.ioenvfile
lib.rsenvfile
version0.2.1
sourcesrc
created_at2018-11-02 17:06:46.564115
updated_at2019-02-15 23:55:21.965034
descriptionBuffer an environment file into an in-memory map, update the map, and write back to the file
homepage
repositoryhttps://github.com/pop-os/envfile
max_upload_size
id94354
size10,617
Jeremy Soller (jackpot51)

documentation

README

envfile

Rust crate for parsing environment files into an in-memory map.

extern crate envfile;

use envfile::EnvFile;
use std::io;
use std::path::Path;

fn main() -> io::Result<()> {
    let mut envfile = EnvFile::new(&Path::new("examples/test.env"))?;

    for (key, value) in &envfile.store {
        println!("{}: {}", key, value);
    }

    envfile.update("ID", "example");
    println!("ID: {}", envfile.get("ID").unwrap_or(""));

    // envfile.write()?;

    Ok(())
}
Commit count: 12

cargo fmt