Rust wrapper around libucl
A lightweight wrapper library in Rust around libucl, a library used for parsing of UCL (Universal Configuration Language) files.
Requirements
CMake and a C/C++ compiler like gcc or clang.
Note: Currently, support for remote includes is disabled. Plan is to add it as a feature flag, as it additionally requires libcurl / libfetch.
Platform support
Linux / Mac OS
libucl is buildable on Windows, but it is currently not tested.
Basics
You can read all about UCL (Universal Configuration Language) here
Usage
use Parser;
let parser = new;
let result = parser.parse.unwrap;
println!;
Validation
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.
use Parser;
let parser = new;
let item = parser.parse.unwrap;
let parser = new;
let schema = parser.parse.unwrap;
let res = item.validate_with_schema;
assert_eq!;
Dump Object
It's possible to dump objects into JSON, JSON compact, YAML and Config format
let parser = new;
let result = parser.parse.unwrap;
let regex = new.unwrap;
let val = result.dump_into;
assert_eq!;
UCL tool
With the UCL tool you can convert input files into a specified format. The input and output file for the tool default to stdin and stdout so you can use them in a pipe. You can also specify a schema file and perform validation.
USAGE:
ucltool [OPTIONS] [help]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-f, --format <format> Specify the output format [default: ucl] [possible values: ucl, json, json_compact, yaml,
msgpack]
-i, --in <INFILE> Specify input filename path (defaults to standard input)
-o, --out <OUTFILE> Specify output filename path(defaults to standard output)
-s, --schema <SCHEMA> Specify schema file path to perform validation
ARGS:
<help> print this message and exit
Licence
Check out LICENSE file.