[][src]Function serde_xml_rs::de::from_reader

pub fn from_reader<'de, R: Read, T: Deserialize<'de>>(
    reader: R
) -> Result<T, Error>

A convenience method for deserialize some object from a reader.

#[derive(Debug, Deserialize, PartialEq)]
struct Item {
    name: String,
    source: String,
}
let s = r##"<item name="hello" source="world.rs" />"##;
let item: Item = from_reader(s.as_bytes()).unwrap();
assert_eq!(item, Item { name: "hello".to_string(),source: "world.rs".to_string()});