xml: Make serialization more ergonomic and clippy appeasement

This commit is contained in:
Lennart K
2025-06-29 17:00:10 +02:00
parent 891ef6a9f3
commit 828e7399c8
9 changed files with 72 additions and 87 deletions

View File

@@ -11,17 +11,17 @@ fn test_struct_value_tagged() {
#[derive(Debug, XmlSerialize, PartialEq)]
enum Prop {
Test(String),
Hello(usize),
Unit,
// Hello(usize),
// Unit,
}
let mut buf = Vec::new();
let mut writer = quick_xml::Writer::new(&mut buf);
Document {
let out = Document {
prop: Prop::Test("asd".to_owned()),
}
.serialize_root(&mut writer)
.serialize_to_string()
.unwrap();
let out = String::from_utf8(buf).unwrap();
assert_eq!(out, "<propfind><prop><test>asd</test></prop></propfind>");
assert_eq!(
out,
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<propfind><prop><test>asd</test></prop></propfind>"
);
}