mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-27 20:27:57 +00:00
Return IdentifierDeserializer to just one associated type
The BorrowedDeserializer was added in #1917, but only makes sense for &str and &[u8], not for u64 which also needs to be have an IdentifierDeserializer impl.
This commit is contained in:
@@ -1992,18 +1992,21 @@ fn deserialize_custom_identifier(
|
||||
(ordinary, Some((fallthrough.clone(), fallthrough)))
|
||||
} else if let Style::Newtype = last.style {
|
||||
let ordinary = &variants[..variants.len() - 1];
|
||||
let fallthrough = |method| {
|
||||
let fallthrough = |value| {
|
||||
quote! {
|
||||
_serde::__private::Result::map(
|
||||
_serde::Deserialize::deserialize(
|
||||
_serde::__private::de::IdentifierDeserializer::#method(__value)
|
||||
_serde::__private::de::IdentifierDeserializer::from(#value)
|
||||
),
|
||||
#this::#last_ident)
|
||||
}
|
||||
};
|
||||
(
|
||||
ordinary,
|
||||
Some((fallthrough(quote!(from)), fallthrough(quote!(borrowed)))),
|
||||
Some((
|
||||
fallthrough(quote!(__value)),
|
||||
fallthrough(quote!(_serde::__private::de::Borrowed(__value))),
|
||||
)),
|
||||
)
|
||||
} else {
|
||||
(variants, None)
|
||||
|
||||
Reference in New Issue
Block a user