#key-value #white-space #pair #delimited #configuration #parser #config-file

whitespace-conf

Key-value configuration file delimited with whitespaces

1 stable release

1.0.0 Jun 27, 2021

#1153 in Text processing

21 downloads per month

MIT/Apache

6KB

whitespace-conf

Rust library for parsing configuration files which are key-value pairs delimited by whitespace. Lines that start with # are ignored.

use std::fs;

fn main() {
    let string = fs::read_to_string("/etc/login.defs").unwrap();

    let defs = linux_login_defs::parse(&string);

    println!("UID_MIN = {:?}", defs.get("UID_MIN"));
    println!("UID_MAX = {:?}", defs.get("UID_MAX"));
}

lib.rs:

Parses configuration files which are key-value pairs delimited by whitespace.

Note

Lines that start with # are ignored.

Example

use std::fs;

fn main() {
    let string = fs::read_to_string("/etc/login.defs").unwrap();

    let defs = linux_login_defs::parse(&string);

    println!("UID_MIN = {:?}", defs.get("UID_MIN"));
    println!("UID_MAX = {:?}", defs.get("UID_MAX"));
}

No runtime deps