#file #env #map #environment #in-memory #update #write

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

#2093 in Parser implementations

Download history 391/week @ 2023-11-23 270/week @ 2023-11-30 409/week @ 2023-12-07 292/week @ 2023-12-14 246/week @ 2023-12-21 261/week @ 2023-12-28 280/week @ 2024-01-04 263/week @ 2024-01-11 295/week @ 2024-01-18 242/week @ 2024-01-25 250/week @ 2024-02-01 322/week @ 2024-02-08 357/week @ 2024-02-15 442/week @ 2024-02-22 460/week @ 2024-02-29 293/week @ 2024-03-07

1,599 downloads per month
Used in 10 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