xml: Fix serialization of unit variants

This commit is contained in:
Lennart
2024-12-28 13:14:14 +01:00
parent 7e74610b75
commit ee21e5a23e

View File

@@ -199,9 +199,13 @@ impl Variant {
}
Fields::Unit => {
quote! {
if let Self::#ident = self {
::rustical_xml::XmlSerialize::serialize(&(), ns, tag, writer)?;
}
if let Self::#ident = &self {
if !enum_untagged {
::rustical_xml::XmlSerialize::serialize(&(), None, Some(#variant_name), writer)?;
} else {
::rustical_xml::XmlSerialize::serialize(&(), None, None, writer)?;
};
}
}
}
}