-
Notifications
You must be signed in to change notification settings - Fork 176
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
Change pattern representation of fractional seconds; remove obsolete FieldLength variants #5392
Conversation
381be5b
to
97e5f57
Compare
97e5f57
to
36c2fea
Compare
There are 2 things going on in this PR: the fractional second change, and removing obsolete FieldLength variants. They are in the same PR because I had earlier thought about supporting fractional seconds via FieldLength, but then I changed to FieldSymbol instead, which ended up being much cleaner. If you want me to cut out the FieldLength changes to their own PR, I can do that upon request. |
#[zerovec::make_ule(DecimalSecondULE)] | ||
#[zerovec::derive(Debug)] | ||
#[allow(clippy::exhaustive_enums)] // used in data struct | ||
pub enum DecimalSecond { |
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.
question, n-b
: what's the advantage of this over DecimalSecond(u8)
?
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.
- Can exhaustively match
- More niches
- Encodes the invariants into the type itself
#1317
This makes it such that adding or removing fractional second digits involves changing one FieldSymbol, rather than going and mutating the choice of fields in the pattern. Simpler and less error-prone at runtime.
The parsing of "ss.SSS" is moved into the parser, where it belongs, rather than handling it at format time.