Skip to main content

try_load_all

Function try_load_all 

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

Load all YAML documents from a string, returning an error if parsing fails.

This is an alias for load_all which also returns errors on invalid syntax.

§Examples

use noyalib::document::try_load_all;

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

let iter = try_load_all(yaml).unwrap();
assert_eq!(iter.len(), 2);

§Errors

Returns an error if the YAML syntax is invalid.