#env #file #map #back #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

#29 in #back

Download history 1424/week @ 2024-11-17 1497/week @ 2024-11-24 1179/week @ 2024-12-01 1789/week @ 2024-12-08 1667/week @ 2024-12-15 751/week @ 2024-12-22 959/week @ 2024-12-29 1763/week @ 2025-01-05 1359/week @ 2025-01-12 1713/week @ 2025-01-19 1794/week @ 2025-01-26 1794/week @ 2025-02-02 1271/week @ 2025-02-09 1374/week @ 2025-02-16 1680/week @ 2025-02-23 1037/week @ 2025-03-02

5,457 downloads per month
Used in 11 crates (6 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