whitespace-conf

June 28, 2021 ยท View on GitHub

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 = whitespace_conf::parse(&string);

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