Expand description
Parse YAML document into alloc::rc::Rc
or alloc::sync::Arc
data holder.
Return an sequence of nodes and the anchors.
use yaml_peg::{parse, node};
let doc = "
---
name: Bob
married: true
age: 46
";
// Node with Rc repr
let (root, anchors) = parse(doc).unwrap();
assert_eq!(anchors.len(), 0);
assert_eq!(root, vec![node!({
"name" => "Bob",
"married" => true,
"age" => 46,
})]);
// Node with Arc repr
let (root, anchors) = parse(doc).unwrap();
assert_eq!(anchors.len(), 0);
assert_eq!(root, vec![node!(arc{
"name" => "Bob",
"married" => true,
"age" => 46,
})]);