You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This parser is not ensure about YAML spec but almost functions are well-implemented. The buffer reader has also not yet been implemented, but the chunks can be read by the sub-parsers.
The anchors can be visited by the loader after parsing.
Different data holder Rc / Arc provides parallel visiting and less copy cost.
Provide document positions and tags on the nodes.
Support anchors / alias.
Direct mode: Embed the alias directly.
Cyclic mode: Keep the alias placeholder, for cyclic data.
Support YAML directives YAML and TAG.
WARNING: %YAML 1.1 will still be treated as 1.2.
%YAML 1.2%TAG !x! tag:my.prefix:
---
Support serde to help you serialize and deserialize a specific type. (as well as the non-cyclic anchors)
use serde::Deserialize;use yaml_peg::serde::from_str;#[derive(Deserialize)]structMember{name:String,married:bool,age:u8,}let doc = "---name: Bobmarried: trueage: 46";// Return Vec<Member>, use `.remove(0)` to get the first onelet officer = from_str::<Member>(doc).unwrap().remove(0);assert_eq!("Bob", officer.name);assert!(officer.married);assert_eq!(46, officer.age);
About
A YAML 1.2 parser using a greedy parsing algorithm with PEG atoms. Support anchors, directives, positions, tags, serde, and no-std.