xml serialize_to_string: Enable indentation

This commit is contained in:
Lennart
2025-07-10 15:45:07 +02:00
parent b02f7c427a
commit 32b616fd75
4 changed files with 30 additions and 7 deletions

View File

@@ -43,7 +43,7 @@ pub trait XmlSerializeRoot {
fn serialize_to_string(&self) -> std::io::Result<String> {
let mut buf: Vec<_> = b"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".into();
let mut writer = quick_xml::Writer::new(&mut buf);
let mut writer = quick_xml::Writer::new_with_indent(&mut buf, b' ', 4);
self.serialize_root(&mut writer)?;
Ok(String::from_utf8_lossy(&buf).to_string())
}