-
Notifications
You must be signed in to change notification settings - Fork 175
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
Refactor: Update CompactCount
to use PluralCategory
enum
#5401
Conversation
"few" => Count::Few, | ||
"many" => Count::Many, | ||
"other" => Count::Other, | ||
"zero" => PluralCategory::Zero, |
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.
You can use PluralCategory::get_for_cldr_bytes
here
3 => Count::Few, | ||
4 => Count::Many, | ||
5 => Count::Other, | ||
0 => PluralCategory::Zero, |
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.
You can use (unaligned.0 & 0b0000_0111) as PluralCategory
, as it's repr(u8)
with stable discriminants
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.
error[E0605]: non-primitive cast: `u8` as `PluralCategory`
--> components/experimental/src/dimension/provider/compact_count_ule.rs:67:22
|
67 | let count = (unaligned.0 & 0b0000_0111) as PluralCategory;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
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.
Related to issue #5369.