-
Add
serde(other)variant attribute for deserializing any variant that is not one of the others (#1382)#[derive(Deserialize)] #[serde(tag = "variant")] enum MyEnum { A(ModelA), B(ModelB), #[serde(other)] Unknown, }
In this internally tagged enum the
MyEnum::Unknownvariant would be produced if the"variant"tag in the input is neither"A"nor"B".This feature is currently limited to externally tagged and adjacently tagged enums in which the
othervariant is a unit variant.