You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that these values do not get passed down to the serialization methods. For example, if we serialize Enum::Struct { a: 1, b: 2 }, it invokes serialize_struct_variant(self, name = "Enum", variant_index = 2, variant = "Struct", len = 2), whereas it would be reasonable to expect the true enum discriminant variant_index = 12.
Since changing this behavior would introduce a breaking change, it would be helpful to have a container-level attribute (e.g., #[serde(explicit_tags)]) that supports to the true discriminant values. Additionally, if you know of any current workarounds, we would appreciate it.
The text was updated successfully, but these errors were encountered:
As described in the Rust reference, enum discriminant values (a.k.a.
variant_indexes
) can be assigned explicitly. For example:The problem is that these values do not get passed down to the serialization methods. For example, if we serialize
Enum::Struct { a: 1, b: 2 }
, it invokesserialize_struct_variant(self, name = "Enum", variant_index = 2, variant = "Struct", len = 2)
, whereas it would be reasonable to expect the true enum discriminantvariant_index = 12
.Since changing this behavior would introduce a breaking change, it would be helpful to have a container-level attribute (e.g.,
#[serde(explicit_tags)]
) that supports to the true discriminant values. Additionally, if you know of any current workarounds, we would appreciate it.The text was updated successfully, but these errors were encountered: