#env #file

envfile

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

1 unstable release

0.1.0 Nov 2, 2018

#26 in #env

Download history 15/week @ 2018-11-07 5/week @ 2018-11-14 8/week @ 2018-11-21 3/week @ 2018-11-28 23/week @ 2018-12-05 5/week @ 2018-12-12 3/week @ 2018-12-19 8/week @ 2018-12-26

0 downloads per month

MIT license

9KB
148 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