Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/RReverser/serde-xml-rs

xml-rs based deserializer for Serde (compatible with 1.0+)
https://github.com/RReverser/serde-xml-rs

deserialization parsing rust serde xml

Last synced: 11 days ago
JSON representation

xml-rs based deserializer for Serde (compatible with 1.0+)

Awesome Lists containing this project

README

        

# serde-xml-rs

[![Build Status](https://travis-ci.org/RReverser/serde-xml-rs.svg?branch=master)](https://travis-ci.org/RReverser/serde-xml-rs)

`xml-rs` based deserializer for Serde (compatible with 1.0)

## Example usage

```rust
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#"BananaStore"#;
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);
}
```