A lightweight wrapper library in Rust around libucl, a library used for parsing of UCL (Universal Configuration Language) files.
You can read all about UCL (Universal Configuration Language) here
```rust use libucl::Parser;
let parser = Parser::new(); let result = parser.parse(r#"tag = "svc"; upstream { h2c = true; host = "http://localhost"; port = 9090; connect_timeout = 1s; }"#).unwrap();
println!("{}", result.fetchpath("upstream.h2c").andthen(|v| v.as_bool()));
```
You can write validation schemas in UCL format as well, as long as it follows the JSON Schema rules for defining a schema with the exception of remote references. UCL currently is not absolutely strict about validation schemas themselves, therefore UCL users should supply valid schemas (as it is defined in json-schema draft v4) to ensure that the input objects are validated properly. ```rust use libucl::Parser;
let parser = Parser::new(); let item = parser.parse(r#" { "key": "some string" }"# ).unwrap();
let parser = Parser::new(); let schema = parser.parse(r#" { "type": "object", "properties":{ "key": { "type":"string" } } }"# ).unwrap(); let res = item.validatewithschema(&schema); asserteq!(res.isok(), true);
```
In your Cargo.toml
file under [dependencies]
add libucl = "0.2.1"
Check out LICENSE file.