commit | 169b9f3e6eb2c142859c8b9c6abd1fac7e8665b2 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Thu May 23 23:15:04 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Thu May 23 23:15:04 2024 +0000 |
tree | 2b154e0fcffd1f06829b7c784fe6a3a0a4f52cf4 | |
parent | 66860b37c4858593eed44ed1ae9bef061e771cc3 [diff] | |
parent | 098521f2a572c6454f13c25d279574ab75cedac1 [diff] |
Snap for 11881322 from 098521f2a572c6454f13c25d279574ab75cedac1 to 24Q3-release Change-Id: I497008155704784ca7921c3b81aae540d076b250
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); }