Function serde_xml_rs::serialize
[−]
[src]
pub fn serialize<W: Write, S: Serialize>(
value: S,
writer: W
) -> Result<(), Error>
A convenience method for serializing some object to a buffer.
You'll almost always want to use this over any of the other things in the
serde_xml_rs::serialize
module.
Examples
#[derive(Serialize)] struct Person { name: String, age: u32, } let mut buffer = Vec::new(); let joe = Person {name: "Joe".to_string(), age: 42}; serialize(&joe, &mut buffer).unwrap(); let serialized = String::from_utf8(buffer).unwrap(); println!("{}", serialized);