#env #file

envfile

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

3 unstable releases

Uses old Rust 2015

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

#97 in #env

Download history 264/week @ 2022-12-07 314/week @ 2022-12-14 227/week @ 2022-12-21 254/week @ 2022-12-28 230/week @ 2023-01-04 339/week @ 2023-01-11 321/week @ 2023-01-18 434/week @ 2023-01-25 461/week @ 2023-02-01 288/week @ 2023-02-08 376/week @ 2023-02-15 370/week @ 2023-02-22 232/week @ 2023-03-01 441/week @ 2023-03-08 224/week @ 2023-03-15 237/week @ 2023-03-22

1,228 downloads per month
Used in 9 crates (5 directly)

MIT and GPL-3.0-only

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