Expand description
§Babbel KDL
Fast, pure-Rust parser, serializer, and [FormatEngine] implementation for
KDL (KDL Document Language), a human-friendly configuration and document language.
§Features
- Full KDL Syntax: Nodes, positional arguments, named properties (
key=val), and nested children blocks ({ ... }). - Comments: Single-line (
//), nested multi-line block (/* /* */ */), and node/entry slashdash comments (/-). - Rich Types: Raw strings (
r#"..."#), unicode escape sequences (\u{...}), number bases (hex0x, octal0o, bin0b, float, exponents, underscores), booleans (true/false), andnull. - Zero Dependencies: Pure Rust with optional
no_std+allocsupport. - Unified Architecture: Integrates into Babbel’s universal
ValueAST and cross-format conversion matrix.
§Quickstart
use babbel_kdl::{from_str, to_string_pretty};
let kdl_source = r#"
package {
name "babbel"
version "0.2.1"
features "kdl" "ron"
}
"#;
let value = from_str(kdl_source).expect("parse failed");
assert!(value.get("package").is_some());
let pretty_kdl = to_string_pretty(&value, 2).expect("serialize failed");
println!("{}", pretty_kdl);Re-exports§
pub use ast::KdlDocument;pub use ast::KdlEntry;pub use ast::KdlNode;pub use ast::KdlValue;pub use engine::KdlEngine;pub use error::KdlError;pub use parser::parse_document;pub use serializer::to_string;pub use serializer::to_string_pretty;
Modules§
- ast
- KDL Document Abstract Syntax Tree and conversion to Babbel
Value. - engine
- KDL Format Engine implementation adhering to OCP and DIP.
- error
- Error types for the KDL parser and serializer.
- parser
- KDL recursive-descent parser supporting full KDL syntax.
- serializer
- KDL serializer supporting compact and pretty-printed formatting.
Enums§
- Value
- Universal hierarchical data value across XML, JSON, YAML, and Bencode representations.
Functions§
- from_
bytes - Deserialize a universal Babbel
Valuefrom UTF-8 KDL bytes. - from_
slice - Deserialize a universal Babbel
Valuefrom UTF-8 KDL bytes. - from_
str - Deserialize a universal Babbel
Valuefrom a KDL string. - to_vec
- Serialize a universal Babbel
Valueto a KDL byte vector.