Skip to main content

from_str_multi

Function from_str_multi 

Source
pub fn from_str_multi<T>(s: &str) -> Result<Vec<T>>
where T: DeserializeOwned + 'static,
Expand description

Iterate every YAML document in a multi-document stream and deserialize each into T. Mirrors the Deserializer::from_str chained with into_iter::<T>() — the typical serde_yaml multi-document idiom.

§Examples

use noyalib::compat::serde_yaml as syml;
let yaml = "1\n---\n2\n---\n3\n";
let docs: Vec<i32> = syml::from_str_multi(yaml).unwrap();
assert_eq!(docs, vec![1, 2, 3]);