pub fn parse<R: Repr>(doc: &str) -> Result<Seq<R>, PError>
Expand description
Parse non-cyclic YAML document into alloc::rc::Rc
or
alloc::sync::Arc
data holder. Return an sequence of nodes and insert the
anchors automatically.
use yaml_peg::{parse, node};
let doc = "
---
name: Bob
married: true
age: 46
";
// Node with Rc repr
let root = parse(doc).unwrap();
assert_eq!(root, vec![node!({
"name" => "Bob",
"married" => true,
"age" => 46,
})]);
// Node with Arc repr
let root = parse(doc).unwrap();
assert_eq!(root, vec![node!(arc{
"name" => "Bob",
"married" => true,
"age" => 46,
})]);