Bug: 193649110

Clone this repo:
  1. 66860b3 Migrate to cargo_embargo. am: 888635dbe0 am: e2ee5bc919 am: 35741362a3 by Andrew Walbran · 6 months ago main main-16k master
  2. 008ca82 Migrate to cargo_embargo. am: 888635dbe0 am: 1715e253c5 am: 9fbf404136 by Andrew Walbran · 6 months ago
  3. 3574136 Migrate to cargo_embargo. am: 888635dbe0 am: e2ee5bc919 by Andrew Walbran · 6 months ago
  4. 9fbf404 Migrate to cargo_embargo. am: 888635dbe0 am: 1715e253c5 by Andrew Walbran · 6 months ago
  5. 1715e25 Migrate to cargo_embargo. am: 888635dbe0 by Andrew Walbran · 6 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);
}