cargo serde 1.0.79

latest releases: 1.0.198, 1.0.197, 1.0.196...
5 years ago
  • 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::Unknown variant 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 other variant is a unit variant.

Don't miss a new serde release

NewReleases is sending notifications on new releases.