#env #file #update #map #environment #in-memory #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

#2872 in Parser implementations

Download history 519/week @ 2024-07-23 558/week @ 2024-07-30 587/week @ 2024-08-06 663/week @ 2024-08-13 666/week @ 2024-08-20 558/week @ 2024-08-27 582/week @ 2024-09-03 534/week @ 2024-09-10 575/week @ 2024-09-17 687/week @ 2024-09-24 762/week @ 2024-10-01 488/week @ 2024-10-08 732/week @ 2024-10-15 750/week @ 2024-10-22 668/week @ 2024-10-29 945/week @ 2024-11-05

3,147 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