WIP: Complete work of propfind parsing

This commit is contained in:
Lennart
2025-06-04 18:11:25 +02:00
parent 5ad6ee2e99
commit e57a14cad1
43 changed files with 875 additions and 1036 deletions

View File

@@ -85,8 +85,8 @@ impl Variant {
) {
(_, Fields::Named(_), _) => {
panic!(
"struct variants are not supported, please use a tuple variant with a struct"
)
"struct variants are not supported, please use a tuple variant with a struct"
)
}
(false, Fields::Unnamed(FieldsUnnamed { unnamed, .. }), true) => {
if unnamed.len() != 1 {
@@ -165,16 +165,20 @@ impl Variant {
}
let field = unnamed.iter().next().unwrap();
quote! {
if let Ok(val) = <#field as ::rustical_xml::XmlDeserialize>::deserialize(reader, start, empty) {
return Ok(Self::#ident(val));
match <#field as ::rustical_xml::XmlDeserialize>::deserialize(reader, start, empty) {
Ok(val) => { return Ok(Self::#ident(val)) }
Err(::rustical_xml::XmlError::InvalidVariant(..)) => {}
Err(err) => { return Err(err) }
}
}
}
Fields::Unit => {
quote! {
// Make sure that content is still consumed
if let Ok(_) = <() as ::rustical_xml::XmlDeserialize>::deserialize(reader, start, empty) {
return Ok(Self::#ident);
match <() as ::rustical_xml::XmlDeserialize>::deserialize(reader, start, empty) {
Ok(val) => { return Ok(Self::#ident(val)) }
Err(::rustical_xml::XmlError::InvalidVariant(..)) => {}
Err(err) => { return Err(err) }
}
}
}