commit | 565b261de703fafd39a79daf05d39926b3998e89 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <[email protected]> | Thu Mar 09 18:06:58 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Mar 09 18:06:58 2023 +0000 |
tree | f28edf70919a5f518c0342d4a8b3e89ec7b03094 | |
parent | 9a2a116e913bdf55488b800342a5c339519799dd [diff] | |
parent | f4ce4bcf89a6d37225f3fc87b2a39667552fc7f4 [diff] |
Make serde-xml-rs available to product and vendor am: 4d529d4e84 am: 7f115b7b3b am: f517e4cf4d am: f4ce4bcf89 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/serde-xml-rs/+/2476460 Change-Id: I5d29734989ee0262b6e90a1d2512e1ac10d720cb 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); }