Function yaml_peg::parser::parse[][src]

pub fn parse(doc: &str) -> Result<(Array<RcRepr>, AnchorBase<RcRepr>), String>
Expand description

Parse YAML document into alloc::rc::Rc data holder. Return an array of nodes and the anchors.

use yaml_peg::{parse, node};

let doc = "
---
name: Bob
married: true
age: 46
";
let (n, anchors) = parse(doc).unwrap();
assert_eq!(anchors.len(), 0);
assert_eq!(n, vec![node!({
    "name" => "Bob",
    "married" => true,
    "age" => 46,
})]);