Function nccl::parse_config

source ·
pub fn parse_config(content: &str) -> Result<Config<'_>, NcclError>
Expand description

Parse a nccl configuration

e.g.

// config.nccl:
// server
//     domain
//         example.com
//         www.example.com
//     port
//         80
//         443
//     root
//         /var/www/html

// read the config file
let content = std::fs::read_to_string("examples/config.nccl").unwrap();

// parse it
let config = parse_config(&content).unwrap();

// look ma, no types!
assert_eq!(config["server"]["root"].value(), Some("/var/www/html"));