Function serde_xml_rs::de::from_str[][src]

pub fn from_str<'de, T: Deserialize<'de>>(s: &str) -> Result<T, Error>
Expand description

A convenience method for deserialize some object from a string.

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