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

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

#2843 in Parser implementations

Download history 555/week @ 2024-09-04 570/week @ 2024-09-11 562/week @ 2024-09-18 668/week @ 2024-09-25 750/week @ 2024-10-02 489/week @ 2024-10-09 725/week @ 2024-10-16 885/week @ 2024-10-23 617/week @ 2024-10-30 994/week @ 2024-11-06 1019/week @ 2024-11-13 1620/week @ 2024-11-20 1461/week @ 2024-11-27 1332/week @ 2024-12-04 1757/week @ 2024-12-11 1283/week @ 2024-12-18

6,213 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