#reader-writer #section #file #name

deprecated nbconf

Simple configuration file reader/writer

7 releases (2 stable)

1.0.1 Mar 17, 2024
1.0.0 Aug 29, 2019
0.9.0 May 13, 2019
0.8.0 May 13, 2019
0.5.0 May 13, 2019

#114 in #section

Download history 120/week @ 2024-03-15 13/week @ 2024-03-22 27/week @ 2024-03-29 8/week @ 2024-04-05

223 downloads per month

Apache-2.0

10KB
210 lines

nbconf

This tool is no longer under active development. If you are interested in taking over or repurposing the name on crates.io, feel free to contact me: nbishop@nbishop.net

crates.io Documentation

Simple configuration file reader/writer. This is intended for use with config files that are human readable but machine written.

Format

The format is simple: key-value pairs nested under sections. Example:

[Section 1]
hello = world

[Section 2]
nice to = meet you

lib.rs:

Example:

let conf = nbconf::Conf::parse_str("
    [Section 1]
    hello = world

    [Section 2]
    nice to = meet you").expect("failed to parse config");

assert_eq!(conf.sections[0].name, "Section 1");
assert_eq!(conf.sections[0].entries[0].key, "hello");
assert_eq!(conf.sections[0].entries[0].value, "world");

assert_eq!(conf.sections[1].name, "Section 2");
assert_eq!(conf.sections[1].entries[0].key, "nice to");
assert_eq!(conf.sections[1].entries[0].value, "meet you");

No runtime deps