dtolnay / serde-yaml

Strongly typed YAML library for Rust
Apache License 2.0
965 stars 165 forks source link

Support multi-doc deserialization #189

Closed dtolnay closed 3 years ago

dtolnay commented 3 years ago
use anyhow::Result;
use serde::Deserialize;
use serde_yaml::Value;

fn main() -> Result<()> {
    let input = "---\nk: 107\n...\n---\nj: 106\n";

    for document in serde_yaml::Deserializer::from_str(input) {
        let value = Value::deserialize(document)?;
        println!("{:?}", value);
    }

    Ok(())
}

Closes #175.