Function yaml_peg::dumper::dump [−][src]
pub fn dump<I>(nodes: I) -> String where
I: IntoIterator,
I::Item: Dumper,
Expand description
Dump the YAML data in to block format.
Dumper will use plain string when the string is none-wrapped, otherwise it use literal string and trim the last white spaces.
use yaml_peg::{dump, node, dumper::NL}; let doc = dump(vec![ node!({ node!("a") => node!("b"), node!("c") => node!("d"), }), ]); assert_eq!(doc, format!("a: b{0}c: d{0}", NL));
When calling parse
function then dump
the string, the string can be reformatted.