-
Notifications
You must be signed in to change notification settings - Fork 543
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 timestamp_nanos_opt
, deprecate timestamp_nanos
#1275
Add timestamp_nanos_opt
, deprecate timestamp_nanos
#1275
Conversation
Codecov Report
@@ Coverage Diff @@
## 0.4.x #1275 +/- ##
==========================================
- Coverage 91.40% 91.37% -0.03%
==========================================
Files 38 38
Lines 16932 16957 +25
==========================================
+ Hits 15477 15495 +18
- Misses 1455 1462 +7
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
35e6ac5
to
0ff33d3
Compare
src/datetime/serde.rs
Outdated
@@ -180,7 +188,10 @@ pub mod ts_nanoseconds { | |||
where | |||
S: ser::Serializer, | |||
{ | |||
serializer.serialize_i64(dt.timestamp_nanos()) | |||
serializer.serialize_i64( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all of these, why not yield errors here?
(Let's not have a .
in expect()
messages.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, they should just return an error.
0ff33d3
to
7d20d22
Compare
NaiveDateTime::timestamp_nanos
andDateTime::timestamp_nanos
are two of the few methods that can panic on somewhat reasonable values and have no alternative that returnsOption
.I added
timestamp_nanos_opt
and went ahead and deprecated the the old methods, like all other fallible methods.The new method lead to a nice little simplification in
duration_round
andduration_trunc
.