Snap for 8346178 from 35fd00e5cb222253922bcbaad4d6c306c3dcf583 to simpleperf-release

Change-Id: I5f092f48b3fedf1af76ddfe490025086f13cf0d9
tree: 4cc3dcf01cb697f27e3259054911f12121c7a726
  1. .github/
  2. src/
  3. tests/
  4. .cargo_vcs_info.json
  5. .gitignore
  6. .travis.yml
  7. Android.bp
  8. Cargo.toml
  9. Cargo.toml.orig
  10. cargo2android.json
  11. LICENSE
  12. METADATA
  13. MODULE_LICENSE_MIT
  14. OWNERS
  15. README.md
  16. rustfmt.toml
  17. TEST_MAPPING
README.md

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);
}