Bug: 193649110

Clone this repo:
  1. 888635d Migrate to cargo_embargo. by Andrew Walbran · 3 weeks ago main master
  2. f4ce4bc Make serde-xml-rs available to product and vendor am: 4d529d4e84 am: 7f115b7b3b am: f517e4cf4d by Matthew Maurer · 9 months ago android14-dev
  3. f517e4c Make serde-xml-rs available to product and vendor am: 4d529d4e84 am: 7f115b7b3b by Matthew Maurer · 9 months ago
  4. 7f115b7 Make serde-xml-rs available to product and vendor am: 4d529d4e84 by Matthew Maurer · 9 months ago android-u-beta-1-gpl
  5. 4d529d4 Make serde-xml-rs available to product and vendor by Matthew Maurer · 9 months ago

serde-xml-rs

Build Status

xml-rs based deserializer for Serde (compatible with 1.0)

Example usage

use serde::{Deserialize, Serialize};
use serde_xml_rs::{from_str, to_string};

#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Item {
    name: String,
    source: String,
}

fn main() {
    let src = r#"<Item><name>Banana</name><source>Store</source></Item>"#;
    let should_be = Item {
        name: "Banana".to_string(),
        source: "Store".to_string(),
    };

    let item: Item = from_str(src).unwrap();
    assert_eq!(item, should_be);

    let reserialized_item = to_string(&item).unwrap();
    assert_eq!(src, reserialized_item);
}