Open younies opened 3 months ago
The standard enum already exists: icu_plurals::PluralCategory
I like the idea of component-specific enums extending the standard one. Alternatively, I would be okay with icu_plurals
exporting an enum with the explicit rules.
In this case, we can use icu_plurals::PluralCategory.
But we need to address two things:
PluralCategory
. Then, the user can manipulate the remaining 4 bits as needed.make_ule
could handle this without a need of intervetion.Example of an extended enume
: https://github.com/unicode-org/icu4x/pull/5375
and a problem that need to be solved: https://github.com/unicode-org/icu4x/pull/5375#issuecomment-2291286186
repr(u8)
.=0
and =1
. When CLDR supports currency matching something like =73
, then we can update our enum accordingly. But we are only supporting what CLDR specifies, and we don't need to design a general solution prematurely.plurals
crate for what is needed.=0
and =1
.icu_plurals::PluralCategoryExtended
.Proposal:
icu_plurals::PluralCategoryExtended
which is PluralCategory
but with Explicit0
, Explicit1
, and is non-exhaustive so more explicits can be addedPluralRules::extended_category_for
which returns PluralCategoryExtended
LGTM: @sffc @Manishearth @younies @echeran
Summary
Currently, the enum
Count
is being used in multiple places aroundicu4x
, such asunits
,currency
,decimal
... etc.PluralRules
place an enum called lPluralRuleCount
, which would contain all the CLDR counts:PluralRuleCount
.PluralRuleCount
.