#serialization #required #deserialize #deserializer #serde-derive #derive-debug #partial-eq

serde-xml-any

xml-rs based deserializer for Serde, with changes required for serde_any

1 unstable release

Uses old Rust 2015

0.0.3 Jul 19, 2018

#40 in #partial-eq

Download history 87/week @ 2024-05-08 94/week @ 2024-05-15 82/week @ 2024-05-22 102/week @ 2024-05-29 134/week @ 2024-06-05 146/week @ 2024-06-12 105/week @ 2024-06-19 136/week @ 2024-06-26 66/week @ 2024-07-03 67/week @ 2024-07-10 107/week @ 2024-07-17 84/week @ 2024-07-24 141/week @ 2024-07-31 83/week @ 2024-08-07 57/week @ 2024-08-14 35/week @ 2024-08-21

342 downloads per month
Used in 2 crates

MIT license

37KB
972 lines

serde-xml-any

A copy of serde-xml-rs with changes required for serde_any.


lib.rs:

Examples

extern crate serde;
extern crate serde_xml_rs;

#[macro_use]
extern crate serde_derive;

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

Dependencies

~3–4.5MB
~92K SLoC