Closed dtolnay closed 3 years ago
use anyhow::Result; use serde::Serialize; use std::collections::BTreeMap; fn main() -> Result<()> { let mut buffer = Vec::new(); let mut ser = serde_yaml::Serializer::new(&mut buffer); let mut object = BTreeMap::new(); object.insert("k", 107); object.serialize(&mut ser)?; object.insert("j", 106); object.serialize(&mut ser)?; assert_eq!(buffer, b"---\nk: 107\n...\n---\nj: 106\nk: 107\n"); Ok(()) }