@dtolnay dtolnay released this Feb 16, 2019 · 2 commits to master since this release

  • Support flatten and skip_serializing / skip_deserializing attributes on the same field
Assets 2

@dtolnay dtolnay released this Feb 4, 2019 · 6 commits to master since this release

  • Fix inclusion of tag in struct containing flattened fields (#1468, thanks @jwillbold)
Assets 2

@dtolnay dtolnay released this Feb 4, 2019 · 10 commits to master since this release

  • Implement Serialize and Deserialize for core::ops::Bound<T> (#1466, thanks @0nkery)
Assets 2

@dtolnay dtolnay released this Jan 19, 2019 · 23 commits to master since this release

  • Accept #[serde(alias = "...")] attribute on fields and variants which allows the same field or variant to be deserialized from any of multiple different names in the input (#1458, thanks @Lymia)

    #[derive(Deserialize)]
    struct S {
        #[serde(alias = "old_name")]
        new_name: String,  // will deserialize from either of "old_name" or "new_name"
    }
Assets 2

@dtolnay dtolnay released this Jan 1, 2019 · 36 commits to master since this release

  • Update example code in documentation to 2018 edition
Assets 2

@dtolnay dtolnay released this Dec 28, 2018 · 66 commits to master since this release

  • Support a rename_all specification that applies only to the Serialize impl or only to the Deserialize impl (#1447, thanks @vincascm)

    #[derive(Serialize, Deserialize)]
    #[serde(rename_all(
        serialize = "camelCase",
        deserialize = "SCREAMING_SNAKE_CASE",
    ))]
    struct S { /* ... */ }
  • Allow serializing struct name inside of structs with named fields (#1448, thanks @motu42)

    #[derive(Serialize)]
    #[serde(tag = "type")]
    struct S { /* ... */ }  // serializes as {"type":"S",...}
Assets 2

@dtolnay dtolnay released this Dec 11, 2018 · 80 commits to master since this release

  • Support serde(default) attribute inside of tuple structs and tuple variants (#1442, thanks @tcr)
Assets 2

@dtolnay dtolnay released this Dec 8, 2018 · 87 commits to master since this release

  • Better error messages when using an invalid combination of serde attributes (#1424, thanks @hcpl)
  • Support deserializing tagged enums inside of untagged enums in formats that encode tagged enum variants by index, like MessagePack (#1437, thanks @daboross)
Assets 2

@dtolnay dtolnay released this Oct 14, 2018 · 108 commits to master since this release

  • Performance optimization for Vec::deserialize_in_place to deserialize elements in place (#1411)
Assets 2

@dtolnay dtolnay released this Sep 15, 2018 · 127 commits to master since this release

  • 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.

Assets 2