#serialization #serde-derive #required #deserialize #deserializer #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

#31 in #partial-eq

Download history 104/week @ 2024-07-20 154/week @ 2024-07-27 72/week @ 2024-08-03 75/week @ 2024-08-10 52/week @ 2024-08-17 59/week @ 2024-08-24 122/week @ 2024-08-31 97/week @ 2024-09-07 126/week @ 2024-09-14 121/week @ 2024-09-21 141/week @ 2024-09-28 94/week @ 2024-10-05 118/week @ 2024-10-12 157/week @ 2024-10-19 129/week @ 2024-10-26 176/week @ 2024-11-02

581 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–8.5MB
~87K SLoC