Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for time v0.3 types #450

Merged
merged 5 commits into from May 12, 2022
Merged

Add support for time v0.3 types #450

merged 5 commits into from May 12, 2022

Conversation

jonasbb
Copy link
Owner

@jonasbb jonasbb commented May 12, 2022

Add support for the time crate v0.3.

  • Convert time::Duration with Duration*Second.
  • Convert time::OffsetDateTime and time::PrimitiveDateTime with Timestamp*Seconds.
  • Turn Rfc2822 and Rfc3339 into conversion type, such that they can be used inside collections.
  • Add tests for the new functionality

Todo:

  • Update Changelog

This includes implementations of the Duration*Seconds and Timestamp*Seconds
types. The Timestamp*Seconds converters are implemented for both
`PrimitiveDateTime` and `OffsetDateTime`.
It also includes the well-known format specifiers `Rfc2822` and `Rfc3339`
as converters for `OffsetDateTime`:

    #[serde_as(as = "Rfc2822")]
    datetime: OffsetDateTime,

Simple tests are included.
* Add a simple module documentation, similar to the chrono one.
* Describe the new feature flag.
* Update the documentations for the Timestamp* and Duration* types, both
  where they are defined and in the transformations list.
* Add new transformations for the well-known Rfc2822 and Rfc3339 types.
The `time` dependency requires Rust 1.53.
Bump the MSRV to support this.
This allows removing some work-arounds for older Rust versions.
It drops support for versions without const-generics and the old array
implementations.
@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #450 (64bdb23) into master (088af5f) will increase coverage by 0.90%.
The diff coverage is 90.53%.

@@            Coverage Diff             @@
##           master     #450      +/-   ##
==========================================
+ Coverage   70.96%   71.87%   +0.90%     
==========================================
  Files          52       54       +2     
  Lines        3465     3634     +169     
==========================================
+ Hits         2459     2612     +153     
- Misses       1006     1022      +16     
Impacted Files Coverage Δ
serde_with/src/lib.rs 75.00% <ø> (ø)
serde_with/src/utils/duration.rs 87.79% <ø> (ø)
serde_with_test/tests/derive_display_fromstr.rs 0.00% <ø> (ø)
serde_with_test/tests/flattened_maybe.rs 100.00% <ø> (ø)
serde_with/src/time_0_3.rs 73.33% <73.33%> (ø)
serde_with/tests/time_0_3.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 088af5f...64bdb23. Read the comment docs.

@jonasbb
Copy link
Owner Author

jonasbb commented May 12, 2022

bors merge

@bors
Copy link
Contributor

bors bot commented May 12, 2022

Build succeeded:

@bors bors bot merged commit 4213291 into master May 12, 2022
@bors bors bot deleted the time-0-3 branch May 12, 2022 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant