#env #file

envfile

Buffer an environment file into an in-memory map, update the map, and write back to the file

3 unstable releases

0.2.1 Feb 15, 2019
0.2.0 Dec 2, 2018
0.1.0 Nov 2, 2018

#17 in #env

Download history 20/week @ 2019-07-02 14/week @ 2019-07-09 4/week @ 2019-07-16 2/week @ 2019-07-23 3/week @ 2019-07-30 14/week @ 2019-08-06 2/week @ 2019-08-13 25/week @ 2019-08-20 8/week @ 2019-08-27 37/week @ 2019-09-03 106/week @ 2019-09-10 81/week @ 2019-09-17 42/week @ 2019-09-24 27/week @ 2019-10-01 13/week @ 2019-10-08

67 downloads per month

MIT license

9KB
150 lines

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(())
}

lib.rs:

Libary 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(())
}

Dependencies

~415KB