mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 19:22:26 +00:00
xml: Add support for enum other tuple variants
This commit is contained in:
@@ -119,8 +119,16 @@ impl Variant {
|
||||
}
|
||||
}
|
||||
}
|
||||
(true, Fields::Unnamed(_), _) => {
|
||||
panic!("other for tuple enums not implemented yet")
|
||||
(true, Fields::Unnamed(FieldsUnnamed { unnamed, .. }), _) => {
|
||||
if unnamed.len() != 1 {
|
||||
panic!("tuple variants should contain exactly one element");
|
||||
}
|
||||
quote! {
|
||||
_ => {
|
||||
let val = <#deserializer_type as ::rustical_xml::XmlDeserialize>::deserialize(reader, start, empty)?;
|
||||
Ok(Self::#ident(val))
|
||||
}
|
||||
}
|
||||
}
|
||||
(true, Fields::Unit, _) => {
|
||||
quote! {
|
||||
|
||||
Reference in New Issue
Block a user