cargo serde 1.0.162

latest releases: 1.0.215, 1.0.214, 1.0.213...
18 months ago
  • Support deserializing flattened adjacently tagged enums from data formats which represent fields as bytes, such as the csv crate (#2377, thanks @mfro)

    #[derive(Deserialize)]
    pub struct Record {
        common: u64,
        #[serde(flatten)]
        kind: Kind,
    }
    
    #[derive(Deserialize)]
    #[serde(tag = "kind", content = "parameter", rename_all = "lowercase")]
    enum Kind {
        Foo(u64),
        Bar(bool),
    }
    common,kind,parameter
    1,foo,42
    2,bar,true
    

Don't miss a new serde release

NewReleases is sending notifications on new releases.