-
Notifications
You must be signed in to change notification settings - Fork 549
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 range checks to Parsed::set
and hide fields in docs
#1465
Conversation
2ad4704
to
02db2fa
Compare
02db2fa
to
be2160d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1465 +/- ##
==========================================
- Coverage 92.16% 91.93% -0.24%
==========================================
Files 40 40
Lines 18052 18218 +166
==========================================
+ Hits 16637 16748 +111
- Misses 1415 1470 +55 ☔ View full report in Codecov by Sentry. |
@djc When you have time, can you look at the direction of the documentation in the last commit? Then I'll merge squash it into the right commit. I would like to start building on top of this PR 😄. |
23a65df
to
fdeb06d
Compare
src/format/parsed.rs
Outdated
@@ -575,6 +584,175 @@ impl Parsed { | |||
set_if_consistent(&mut self.offset, i32::try_from(value).map_err(|_| OUT_OF_RANGE)?) | |||
} | |||
|
|||
/// Get the `year` field if set. |
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.
Let's add these below the to_*
methods, since they're pretty trivial?
fdeb06d
to
15f7e62
Compare
This does not remove the range checks from the
Parsed::to_*
methods, because as long as the fields are public they can be set to an out of range value. Something to do on the 0.5.x branch.