Hi team.
I am a contributor from the apache arrow-rs. We are trying to use the const generic to build the Decimal type, like this:
struct Decimal<const BYTE_LENGTH: usize> {...}
(here is the issue link: [Discussion] Refactor the `Decimal`s by using constant generic. · Issue #2001 · apache/arrow-rs · GitHub)
And we want to restrict the BYTE_LENGTH
to be either 16
or 32
.
However, as const_generic_exprs
is an unstable feature, I can't add the value bound to the generic now, like this:
impl<const BYTE_LENGTH: usize> Decimal<BYTE_LENGTH>
where {BYTE_LENGTH == 16 || BYTE_LENGTH == 32}
{...}
Is there an alternative way to add bound to const generic? Or How could we sealed the const generic?