commit | 66860b37c4858593eed44ed1ae9bef061e771cc3 | [log] [tgz] |
---|---|---|
author | Andrew Walbran <[email protected]> | Thu Nov 16 00:06:55 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Nov 16 00:06:55 2023 +0000 |
tree | d947f8267305fd5dc8d7127d4fccf34c195507d5 | |
parent | 008ca82d75679716afda5925e8cf6ae2dcee7abb [diff] | |
parent | 35741362a3a241b6a60960fe3c744f049e19a6de [diff] |
Migrate to cargo_embargo. am: 888635dbe0 am: e2ee5bc919 am: 35741362a3 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/serde-xml-rs/+/2832452 Change-Id: I0ee79264609ac49058d8e249c645c6021235612f Signed-off-by: Automerger Merge Worker <[email protected]>
xml-rs
based deserializer for Serde (compatible with 1.0)
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); }