Skip to content

Releases: jonasbb/serde_with

serde_with v3.4.0

17 Oct 17:05
1e8e4e7
Compare
Choose a tag to compare
  • Lower minimum required serde version to 1.0.152 (#653)
    Thanks to @banool for submitting the PR.

    This allows people that have a problem with 1.0.153 to still use serde_with.

  • Add support for core::ops::Bound (#655)
    Thanks to @qsantos for submitting the PR.

serde_with v3.3.0

19 Aug 09:55
160c70d
Compare
Choose a tag to compare

Added

  • Support the hashbrown type HashMap and HashSet (#636, #637)
    Thanks to @OliverNChalk for raising the issue and submitting a PR.

    This extends the existing support for HashMaps and HashSets to the hashbrown crate v0.14.
    The same conversions as for the std and indexmap types are available, like general support for #[serde_as] and converting it to/from sequences or maps.

Changed

  • Generalize some trait bounds for DeserializeAs implementations

    While working on #637 it came to light that some of the macros for generating DeserializeAs implementations were not as generic as they could.
    This means they didn't work with custom hasher types, but only the default hashers.
    This has now been fixed and custom hashers should work better, as long as they implement BuildHasher + Default.

  • (internal) Change how features are documented (#639)

    This change moves the feature documentation into Cargo.toml in a format that can be read by lib.rs.
    It will improve the generated features documentation there.
    The page with all features remains in the guide but is now generated from the Cargo.toml information.

serde_with v3.2.0

04 Aug 15:56
fc30b63
Compare
Choose a tag to compare

Added

  • Add optional support for indexmap v2 (#621)
    Support for v1 is already available using the indexmap_1 feature.
    This adds identical support for v2 of indexmap using the indexmap_2 feature.

Changed

  • Bump MSRV to 1.64, since that is required for the indexmap v2 dependency.

Fixed

  • Prevent panics when deserializing i64::MIN using TimestampSeconds<i64> (#632, #633)
    Thanks to @hollmmax for reporting and fixing the issue.

serde_with v3.1.0

17 Jul 17:34
20fae7c
Compare
Choose a tag to compare

Added

  • Add FromIntoRef and TryFromIntoRef (#618)
    Thanks to @oblique for submitting the PR.

    The new types are similar to the existing FromInto and TryFromInto types.
    They behave different during serialization, allowing the removal of the Clone bound on their SerializeAs trait implementation

Changed

  • Improve documentation about cfg-gating serde_as (#607)
  • Bump MSRV to 1.61 because that is required by the crate cfg_eval.

serde_with v3.0.0

01 May 21:13
0c080c6
Compare
Choose a tag to compare

This breaking release should not impact most users.
It only affects custom character sets used for base64 of which there are no instances of on GitHub.

Changed

  • Upgrade base64 to v0.21 (#543)
    Thanks to @jeff-hiner for submitting the PR.

    Remove support for custom character sets.
    This is technically a breaking change.
    A code search on GitHub revealed no instances of anyone using that, and serde_with ships with many predefined character sets.
    The removal means that future base64 upgrade will no longer be breaking changes.

serde_with v2.3.3

27 Apr 22:44
a119325
Compare
Choose a tag to compare

Changed

  • Update syn to v2 and darling to v0.20 (#578)
    Update proc-macro dependencies.
    This change should have no impact on users, but now uses the same dependency as serde_derive.

serde_with v2.3.2

05 Apr 20:14
574436b
Compare
Choose a tag to compare

Changed

  • Improve the error message when deserializing OneOrMany or PickFirst fails.
    It now includes the original error message for each of the individual variants.
    This is possible by dropping untagged enums as the internal implementations, since they will likely never support this, as these old PRs show serde#2376 and serde#1544.

    The new errors look like:

    OneOrMany could not deserialize any variant:
      One: invalid type: map, expected u32
      Many: invalid type: map, expected a sequence
    
    PickFirst could not deserialize any variant:
      First: invalid type: string "Abc", expected u32
      Second: invalid digit found in string
    

Fixed

  • Specify the correct minimum serde version as dependency. (#588)
    Thanks to @nox for submitting a PR.

serde_with v2.3.1

10 Mar 23:34
2f15b84
Compare
Choose a tag to compare

Fixed

  • Undo the changes to the trait bound for Seq. (#570, #571)
    The new implementation caused issues with serialization formats that require the sequence length beforehand.
    It also caused problems, that certain attributes which worked before no longer worked, due to mismatching number of references.

    Thanks to @stefunctional for reporting and for @stephaneyfx for providing a test case.

serde_with v2.3.0

09 Mar 22:41
900bc16
Compare
Choose a tag to compare

Added

  • Add serde_as compatible versions for the existing duplicate key and value handling. (#534)
    The new types MapPreventDuplicates, MapFirstKeyWins, SetPreventDuplicates, and SetLastValueWins can replace the existing modules maps_duplicate_key_is_error, maps_first_key_wins, sets_duplicate_value_is_error, and sets_last_value_wins.

  • Added a new KeyValueMap type using the map key as a struct field. (#341)
    This conversion is useful for maps, where an ID value is the map key, but the ID should become part of a single struct.
    The conversion allows this, by using a special field named $key$.

    This conversion is possible for structs and maps, using the $key$ field.
    Tuples, tuple structs, and sequences are supported by turning the first value into the map key.

    Each of the SimpleStructs

    // Somewhere there is a collection:
    // #[serde_as(as = "KeyValueMap<_>")]
    // Vec<SimpleStruct>,
    
    #[derive(Serialize, Deserialize)]
    struct SimpleStruct {
        b: bool,
        // The field named `$key$` will become the map key
        #[serde(rename = "$key$")]
        id: String,
        i: i32,
    }

    will turn into a JSON snippet like this.

    "id-0000": {
      "b": false,
      "i": 123
    },

Changed

  • Relax the trait bounds of Seq to allow for more custom types. (#565)
    This extends the support beyond tuples.

Fixed

  • EnumMap passes the human_readable status of the Serializer to more places.
  • Support alloc on targets without target_has_atomic = "ptr". (#560)
    Thanks to @vembacher for reporting and fixing the issue.

serde_with v2.2.0

09 Jan 22:35
24ee794
Compare
Choose a tag to compare

Added

  • Add new Map and Seq types for converting between maps and tuple lists. (#527)

    The behavior is not new, but already present using BTreeMap/HashMap or Vec.
    However, the new types Map and Seq are also available on no_std, even without the alloc feature.

Changed

  • Pin the serde_with_macros dependency to the same version as the main crate.
    This simplifies publishing and ensures that always a compatible version is picked.

Fixed

  • serde_with::apply had an issue matching types when invisible token groups where in use (#538)
    The token groups can stem from macro_rules expansion, but should be treated mostly transparent.
    The old code required a group to match a group, while now groups are silently removed when checking for type patterns.