mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-28 09:07:57 +00:00
Fix (de)serialization of new types where the internal type is skipped
This commit is contained in:
@@ -1689,6 +1689,24 @@ fn deserialize_externally_tagged_variant(
|
||||
}
|
||||
}
|
||||
Style::Newtype => {
|
||||
if variant.fields[0].attrs.skip_deserializing() {
|
||||
let this = ¶ms.this;
|
||||
let let_default = match variant.fields[0].attrs.default() {
|
||||
attr::Default::Default => quote!(
|
||||
_serde::export::Default::default()
|
||||
),
|
||||
attr::Default::Path(ref path) => quote!(
|
||||
#path()
|
||||
),
|
||||
_ => unimplemented!(),
|
||||
};
|
||||
|
||||
|
||||
return quote_block! {
|
||||
try!(_serde::de::VariantAccess::unit_variant(__variant));
|
||||
_serde::export::Ok(#this::#variant_ident(#let_default))
|
||||
};
|
||||
}
|
||||
deserialize_externally_tagged_newtype_variant(variant_ident, params, &variant.fields[0])
|
||||
}
|
||||
Style::Tuple => {
|
||||
|
||||
Reference in New Issue
Block a user