pub fn parse_cyclic<R: Repr>(
    doc: &str
) -> Result<(Seq<R>, Vec<Anchors<R>>), PError>
Expand description

Parse cyclic YAML document into alloc::rc::Rc or alloc::sync::Arc data holder. Return an sequence of nodes and keep the anchors placeholder.

use yaml_peg::{parse_cyclic, node};

let doc = "
--- &root
map: *root
";
let (root, anchors) = parse_cyclic(doc).unwrap();
assert_eq!(vec![node!({"map" => node!(*"root")})], root);
assert_eq!(anchors[0].get("root").unwrap(), &root[0]);