Bug: 193649110

Clone this repo:
  1. 9c98cc7 Merge "Update TEST_MAPPING" by Treehugger Robot · 3 weeks ago master
  2. 00b4a6f Update TEST_MAPPING by Matthew Maurer · 3 weeks ago
  3. d6505b6 Update TEST_MAPPING am: 5aee022810 by Matthew Maurer · 5 weeks ago
  4. 5aee022 Update TEST_MAPPING by Matthew Maurer · 6 weeks ago
  5. 35fd00e Merge "Refresh Android.bp, cargo2android.json, TEST_MAPPING." am: c14d32c87a am: dcbe6e1bb2 am: ee0c6e14f2 by Joel Galenson · 7 months ago

serde-xml-rs

Build Status

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

Example usage

use serde;
use serde_derive::{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);
}