mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-29 08:17:57 +00:00
Simplify implementation of flattened internally tagged enum
The fact that the tag entry is consumed was only observable if there is
a later flattened map field, at which point the behavior is already
confusing anyway.
#[derive(Deserialize)]
struct Example {
#[serde(flatten)]
a: InternallyTagged,
#[serde(flatten)]
rest: BTreeMap<String, Value>,
}
Before this simplification the map would receive all the fields of the
internally tagged enum but not its tag, after it receives all the fields
including the tag.
This commit is contained in:
@@ -1195,8 +1195,7 @@ fn deserialize_internally_tagged_enum(
|
||||
|
||||
let __tagged = try!(_serde::Deserializer::private_deserialize_internally_tagged_enum(
|
||||
__deserializer,
|
||||
_serde::private::de::TaggedContentVisitor::<__Field>::new(#tag),
|
||||
#tag));
|
||||
_serde::private::de::TaggedContentVisitor::<__Field>::new(#tag)));
|
||||
|
||||
match __tagged.tag {
|
||||
#(#variant_arms)*
|
||||
|
||||
Reference in New Issue
Block a user