-
Notifications
You must be signed in to change notification settings - Fork 85
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
deer
: implement Deserialize
for core::time
#2390
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2390 +/- ##
==========================================
+ Coverage 56.77% 60.90% +4.13%
==========================================
Files 337 318 -19
Lines 26015 24233 -1782
Branches 421 421
==========================================
- Hits 14769 14760 -9
+ Misses 11241 9468 -1773
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 34 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Implementation looks fine, just have a smol question :)
let input = value.as_secs_f64(); | ||
|
||
assert_tokens_with_assertion(|received: Duration| { | ||
assert_relative_eq!(received.as_secs_f64(), value.as_secs_f64()); |
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.
Is approx
used in future implementations? Or can we simply do a - b < f64:EPSILON
for f64 comparisons?
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.
nope not at all, we can indeed just use a - b < f64:EPSILON
. Good catch!
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.
fixed in 9048070
🌟 What is the purpose of this PR?
Implements
Deserialize
for:core::time::Duration
(taken fromdeer
implementDeserialize
for built-in types (Part 2) #1875, same format as serde)Based on #2376, due to new assertion function used for relative equality.
🔗 Related links
deer
implementDeserialize
for built-in types (Part 2) #1875deer
type implementation #1700🔍 Has this modified a publishable library?
This PR: