Function kdl::parse_document [−][src]
pub fn parse_document<I>(input: I) -> Result<Vec<KdlNode>, KdlError> where
I: AsRef<str>, Expand description
Parse a KDL document from a string into a list of KdlNodes.
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![],
}
]
)