#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

#1983 in Parser implementations

Download history 315/week @ 2023-12-18 199/week @ 2023-12-25 254/week @ 2024-01-01 331/week @ 2024-01-08 258/week @ 2024-01-15 244/week @ 2024-01-22 234/week @ 2024-01-29 324/week @ 2024-02-05 331/week @ 2024-02-12 324/week @ 2024-02-19 586/week @ 2024-02-26 356/week @ 2024-03-04 501/week @ 2024-03-11 514/week @ 2024-03-18 449/week @ 2024-03-25 583/week @ 2024-04-01

2,072 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