Update Rust crate serde_with to 2.3.3 #31

Merged
pierre merged 2 commits from renovate/serde_with-2.x into master 2023-05-01 17:29:04 +00:00
Owner

This PR contains the following updates:

Package Type Update Change
serde_with dependencies minor 2.0.1 -> 2.3.3

Release Notes

jonasbb/serde_with

v2.3.3: serde_with v2.3.3

Compare Source

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.

v2.3.2: serde_with v2.3.2

Compare Source

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.

v2.3.1: serde_with v2.3.1

Compare Source

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.

v2.3.0: serde_with v2.3.0

Compare Source

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.

v2.2.0: serde_with v2.2.0

Compare Source

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.

v2.1.0: serde_with v2.1.0

Compare Source

Added
  • Add new apply attribute to simplify repetitive attributes over many fields.
    Multiple rules and multiple attributes can be provided each.

    #[serde_with::apply(
        Option => #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")],
        Option<bool> => #[serde(rename = "bool")],
    )]
    #[derive(serde::Serialize)]
    struct Data {
        a: Option<String>,
        b: Option<u64>,
        c: Option<String>,
        d: Option<bool>,
    }
    

    The apply attribute will expand into this, applying the attributs to the matching fields:

    #[derive(serde::Serialize)]
    struct Data {
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        a: Option<String>,
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        b: Option<u64>,
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        c: Option<String>,
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        #[serde(rename = "bool")]
        d: Option<bool>,
    }
    

    The attribute supports field matching using many rules, such as _ to apply to all fields and partial generics like Option to match any Option be it Option<String>, Option<bool>, or Option<T>.

Fixed
  • The derive macros SerializeDisplay and DeserializeFromStr now take better care not to use conflicting names for generic values. (#​526)
    All used generics now start with __ to make conflicts with manually written code unlikely.

    Thanks to @​Elrendio for submitting a PR fixing the issue.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [serde_with](https://github.com/jonasbb/serde_with) | dependencies | minor | `2.0.1` -> `2.3.3` | --- ### Release Notes <details> <summary>jonasbb/serde_with</summary> ### [`v2.3.3`](https://github.com/jonasbb/serde_with/releases/tag/v2.3.3): serde_with v2.3.3 [Compare Source](https://github.com/jonasbb/serde_with/compare/v2.3.2...v2.3.3) ##### Changed - Update `syn` to v2 and `darling` to v0.20 ([#&#8203;578](https://github.com/jonasbb/serde_with/issues/578)) Update proc-macro dependencies. This change should have no impact on users, but now uses the same dependency as `serde_derive`. ### [`v2.3.2`](https://github.com/jonasbb/serde_with/releases/tag/v2.3.2): serde_with v2.3.2 [Compare Source](https://github.com/jonasbb/serde_with/compare/v2.3.1...v2.3.2) ##### 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#&#8203;2376](https://github.com/serde-rs/serde/pull/2376) and [serde#&#8203;1544](https://github.com/serde-rs/serde/pull/1544). The new errors look like: ```text OneOrMany could not deserialize any variant: One: invalid type: map, expected u32 Many: invalid type: map, expected a sequence ``` ```text 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. ([#&#8203;588](https://github.com/jonasbb/serde_with/issues/588)) Thanks to [@&#8203;nox](https://github.com/nox) for submitting a PR. ### [`v2.3.1`](https://github.com/jonasbb/serde_with/releases/tag/v2.3.1): serde_with v2.3.1 [Compare Source](https://github.com/jonasbb/serde_with/compare/v2.3.0...v2.3.1) ##### Fixed - Undo the changes to the trait bound for `Seq`. ([#&#8203;570](https://github.com/jonasbb/serde_with/issues/570), [#&#8203;571](https://github.com/jonasbb/serde_with/issues/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 [@&#8203;stefunctional](https://github.com/stefunctional) for reporting and for [@&#8203;stephaneyfx](https://github.com/stephaneyfx) for providing a test case. ### [`v2.3.0`](https://github.com/jonasbb/serde_with/releases/tag/v2.3.0): serde_with v2.3.0 [Compare Source](https://github.com/jonasbb/serde_with/compare/v2.2.0...v2.3.0) ##### Added - Add `serde_as` compatible versions for the existing duplicate key and value handling. ([#&#8203;534](https://github.com/jonasbb/serde_with/issues/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. ([#&#8203;341](https://github.com/jonasbb/serde_with/issues/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 `SimpleStruct`s ```rust // 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. ```json "id-0000": { "b": false, "i": 123 }, ``` ##### Changed - Relax the trait bounds of `Seq` to allow for more custom types. ([#&#8203;565](https://github.com/jonasbb/serde_with/issues/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"`. ([#&#8203;560](https://github.com/jonasbb/serde_with/issues/560)) Thanks to [@&#8203;vembacher](https://github.com/vembacher) for reporting and fixing the issue. ### [`v2.2.0`](https://github.com/jonasbb/serde_with/releases/tag/v2.2.0): serde_with v2.2.0 [Compare Source](https://github.com/jonasbb/serde_with/compare/v2.1.0...v2.2.0) ##### Added - Add new `Map` and `Seq` types for converting between maps and tuple lists. ([#&#8203;527](https://github.com/jonasbb/serde_with/issues/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 ([#&#8203;538](https://github.com/jonasbb/serde_with/issues/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. ### [`v2.1.0`](https://github.com/jonasbb/serde_with/releases/tag/v2.1.0): serde_with v2.1.0 [Compare Source](https://github.com/jonasbb/serde_with/compare/v2.0.1...v2.1.0) ##### Added - Add new `apply` attribute to simplify repetitive attributes over many fields. Multiple rules and multiple attributes can be provided each. ```rust #[serde_with::apply( Option => #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")], Option<bool> => #[serde(rename = "bool")], )] #[derive(serde::Serialize)] struct Data { a: Option<String>, b: Option<u64>, c: Option<String>, d: Option<bool>, } ``` The `apply` attribute will expand into this, applying the attributs to the matching fields: ```rust #[derive(serde::Serialize)] struct Data { #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] a: Option<String>, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] b: Option<u64>, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] c: Option<String>, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "bool")] d: Option<bool>, } ``` The attribute supports field matching using many rules, such as `_` to apply to all fields and partial generics like `Option` to match any `Option` be it `Option<String>`, `Option<bool>`, or `Option<T>`. ##### Fixed - The derive macros `SerializeDisplay` and `DeserializeFromStr` now take better care not to use conflicting names for generic values. ([#&#8203;526](https://github.com/jonasbb/serde_with/issues/526)) All used generics now start with `__` to make conflicts with manually written code unlikely. Thanks to [@&#8203;Elrendio](https://github.com/Elrendio) for submitting a PR fixing the issue. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS42NC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNjQuMCJ9-->
pierre added 1 commit 2023-04-29 00:09:23 +00:00
Update Rust crate serde_with to 2.3.3
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
4ed1c9c200
pierre added 1 commit 2023-05-01 17:21:10 +00:00
Merge branch 'master' into renovate/serde_with-2.x
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
3af6fd730e
pierre merged commit 7d92555a85 into master 2023-05-01 17:29:04 +00:00
pierre deleted branch renovate/serde_with-2.x 2023-05-01 17:29:04 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pierre/SeaBattle#31
No description provided.