Skip to content
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

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

younies
Copy link
Member

@younies younies commented Aug 20, 2024

Related to issue #5369.

robertbastian
robertbastian previously approved these changes Aug 20, 2024
"few" => Count::Few,
"many" => Count::Many,
"other" => Count::Other,
"zero" => PluralCategory::Zero,
Copy link
Member

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,
Copy link
Member

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

Copy link
Member Author

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


Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@younies younies merged commit 00b596b into unicode-org:main Aug 20, 2024
28 checks passed
@younies younies deleted the migrate_currency_compact branch August 20, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants