Function reqwest_dav::re_exports::serde_xml_rs::to_writer
source · pub fn to_writer<W, S>(writer: W, value: &S) -> Result<(), Error>
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);