Reduce instantiations of Result::map in Deserialize of unit variants
This eliminates 110 instantiations of Result::map in Xi and reduces binary size by 229 kilobytes.
This commit is contained in:
parent
1a972d2105
commit
df93fab5fa
@ -1626,12 +1626,13 @@ fn deserialize_untagged_variant(
|
|||||||
let type_name = params.type_name();
|
let type_name = params.type_name();
|
||||||
let variant_name = variant.ident.as_ref();
|
let variant_name = variant.ident.as_ref();
|
||||||
quote_expr! {
|
quote_expr! {
|
||||||
_serde::export::Result::map(
|
match _serde::Deserializer::deserialize_any(
|
||||||
_serde::Deserializer::deserialize_any(
|
#deserializer,
|
||||||
#deserializer,
|
_serde::private::de::UntaggedUnitVisitor::new(#type_name, #variant_name)
|
||||||
_serde::private::de::UntaggedUnitVisitor::new(#type_name, #variant_name)
|
) {
|
||||||
),
|
_serde::export::Ok(()) => _serde::export::Ok(#this::#variant_ident),
|
||||||
|()| #this::#variant_ident)
|
_serde::export::Err(__err) => _serde::export::Err(__err),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Style::Newtype => deserialize_untagged_newtype_variant(
|
Style::Newtype => deserialize_untagged_newtype_variant(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user