xml: Implement XmlDeserialize for values

This commit is contained in:
Lennart
2024-12-23 13:45:46 +01:00
parent 98ed1a3fc5
commit 8e0a25b223
2 changed files with 85 additions and 14 deletions

View File

@@ -229,3 +229,27 @@ fn test_struct_unparsed() {
)
.unwrap();
}
#[test]
fn test_xml_values() {
#[derive(XmlDeserialize, XmlRootTag, PartialEq, Debug)]
#[xml(root = b"document", ns_strict)]
struct Document {
href: String,
}
let doc = Document::parse_str(
r#"
<document>
<href>/asd</href>
</document>
"#,
)
.unwrap();
assert_eq!(
doc,
Document {
href: "/asd".to_owned()
}
);
}