Crate kdl[−][src]
KDL is a document language with xml-like semantics that looks like you’re invoking a bunch of CLI commands! It’s meant to be used both as a serialization format and a configuration language, much like JSON, YAML, or XML.
There’s a living specification, as well as various implementations. You can also check out the language FAQ to answer all your burning questions!
This crate is the official/reference implementation of the KDL document language.
License
The code in this crate is covered by the Parity License, a strong copyleft license. That means that you can only use this project if you’re working on an open source-licensed product (MIT/Apache projects are ok!)
Example KDL File
author "Alex Monad" email="alex@example.com" active=true
contents {
section "First section" {
paragraph "This is the first paragraph"
paragraph "This is the second paragraph"
}
}
// unicode! comments!
π 3.14159
Basic Library Example
use kdl::{KdlNode, KdlValue}; use std::collections::HashMap; assert_eq!( kdl::parse_document("node 1 key=true").unwrap(), vec![ KdlNode { name: String::from("node"), values: vec![KdlValue::Int(1)], properties: { let mut temp = HashMap::new(); temp.insert(String::from("key"), KdlValue::Boolean(true)); temp }, children: vec![], } ] )
Structs
KdlError | An error that occurs when parsing a KDL document. |
KdlNode | A node representing the smallest unit of a KDL document. |
TryFromKdlNodeValueError | Coversion errors for converting |
Enums
KdlErrorKind | A type reprenting additional information specific to the type of error being returned. |
KdlValue | A value present in either a node’s values or in a node’s properties. |
Functions
parse_document | Parse a KDL document from a string into a list of |