Function serde_xml_rs::ser::to_writer
source · [−]Expand description
A convenience method for serializing some object to a buffer.
Examples
#[derive(Serialize)]
struct Person {
name: String,
age: u32,
}
let mut buffer = Vec::new();
let joe = Person {name: "Joe".to_string(), age: 42};
to_writer(&mut buffer, &joe).unwrap();
let serialized = String::from_utf8(buffer).unwrap();
println!("{}", serialized);