#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

#1966 in Parser implementations

Download history 515/week @ 2024-03-13 445/week @ 2024-03-20 480/week @ 2024-03-27 524/week @ 2024-04-03 722/week @ 2024-04-10 931/week @ 2024-04-17 396/week @ 2024-04-24 366/week @ 2024-05-01 473/week @ 2024-05-08 431/week @ 2024-05-15 326/week @ 2024-05-22 487/week @ 2024-05-29 470/week @ 2024-06-05 535/week @ 2024-06-12 813/week @ 2024-06-19 564/week @ 2024-06-26

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