xml: Fix attribute serialization

This commit is contained in:
Lennart
2024-12-27 13:16:29 +01:00
parent ff26cf5056
commit fc8d64220f
2 changed files with 7 additions and 4 deletions

View File

@@ -196,10 +196,11 @@ impl NamedStruct {
.filter(|field| field.attrs.xml_ty == FieldType::Attr)
.map(|field| {
let field_name = field.xml_name();
let field_ident = field.field_ident();
quote! {
::quick_xml::events::attributes::Attribute {
key: ::quick_xml::name::QName(#field_name),
value: b"hello".into()
value: ::std::borrow::Cow::from(::rustical_xml::Value::serialize(&self.#field_ident).into_bytes())
}
}
});