Bug: 193649110

Clone this repo:
  1. 7f115b7 Make serde-xml-rs available to product and vendor am: 4d529d4e84 by Matthew Maurer · 3 months ago main master android-u-beta-1-gpl
  2. 4d529d4 Make serde-xml-rs available to product and vendor by Matthew Maurer · 3 months ago
  3. d055e26 Update TEST_MAPPING am: 8675ae13e1 by Jeff Vander Stoep · 4 months ago
  4. 8675ae1 Update TEST_MAPPING by Jeff Vander Stoep · 4 months ago
  5. c0c4969 Update TEST_MAPPING am: fd63022111 by David Brazdil · 4 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);
}