The largest addition to this release is the addition of the serde_as de/serialization scheme.
It's goal is it to be a more flexible replacement to serde's with-annotation, by being more composable than before.
No longer is it a problem to add a custom de/serialization adapter is the type is within an Option or a Vec.
Thanks to @markazmierczak for the design of the trait without whom this wouldn't be possible.
More details about this new scheme can be found in the also new user guide
This release also features a detailed user guide.
The guide focusses more on how to use this crate by providing examples.
For example, it includes a section about the available feature flags of this crate and how you can migrate to the shiny new serde_as scheme.
The crate now features de/serialization adaptors for the std and chrono's Duration types. #56#104
Add a hex module, which allows formatting bytes (i.e. Vec<u8>) as a hexadecimal string.
The formatting supports different arguments how the formatting is happening.
Add two derive macros, SerializeDisplay and DeserializeFromStr, which implement the Serialize/Deserialize traits based on Display and FromStr.
This is in addition to the already existing methods like DisplayFromStr, which act locally, whereas the derive macros provide the traits expected by the rest of the ecosystem.
This is part of serde_with_macros v1.2.0.
Added some serialize functions to modules which previously had none.
This makes it easier to use the conversion when also deriving Serialialize.
The functions simply pass through to the underlying Serialize implementation.
This affects sets_duplicate_value_is_error, maps_duplicate_key_is_error, maps_first_key_wins, default_on_error, and default_on_null.
Added sets_last_value_wins as a replacement for sets_first_value_wins which is deprecated now.
The default behavior of serde is to prefer the first value of a set so the opposite is taking the last value.
Added #[serde_as] compatible conversion methods for serializing durations and timestamps as numbers.
The four types DurationSeconds, DurationSecondsWithFrac, TimestampSeconds, TimestampSecondsWithFrac provide the serialization conversion with optional subsecond precision.
There is support for std::time::Duration, chrono::Duration, std::time::SystemTime and chrono::DateTime.
Timestamps are serialized as a duration since the UNIX epoch.
The serialization can be customized.
It supports multiple formats, such as i64, f64, or String, and the deserialization can be tweaked if it should be strict or lenient when accepting formats.
Changed
Convert the code to use 2018 edition.
@peterjoel improved the performance of with_prefix!. #101
Fixed
The with_prefix! macro, to add a string prefixes during serialization, now also works with unit variant enum types. #115#116
The serde_as macro now supports serde attributes and no longer panic on unrecognized values in the attribute.
This is part of serde_with_macros v1.2.0.
Deprecated
Deprecate sets_first_value_wins.
The default behavior of serde is to take the first value, so this module is not necessary.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Bumps serde_with from 1.4.0 to 1.5.0.
Changelog
Sourced from serde_with's changelog.
Commits
9b56c3a
Merge #182331c664
Bump serde_with to v1.5.0 and serde_with_macros to v1.2.09f8b9de
Merge #181bcf7275
Cleanup the Cargo.toml filesc8eaa73
Merge #179fb39b89
The "Test result" check is wrongly successful.d769f66
Merge #1807743ce7
Fix TimestampSeconds tests on Windows89aec68
Merge #1780684206
Add documentation for TimestampSecondsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired)