Skip to main content

load_all

Function load_all 

Source
pub fn load_all(input: &str) -> Result<DocumentIterator>
Expand description

Load all YAML documents from a string.

This function parses a YAML string that may contain multiple documents separated by --- markers. Default security limits are applied.

§Examples

use noyalib::document::load_all;

let yaml = "---
first: 1
---
second: 2
";

let docs: Vec<_> = load_all(yaml).unwrap().filter_map(Result::ok).collect();
assert_eq!(docs.len(), 2);

§Errors

Returns an error if the YAML syntax is invalid.