Struct icu::experimental::dimension::provider::pattern_key::PatternKeyULE
source · pub struct PatternKeyULE(/* private fields */);
Expand description
PatternKeyULE
is a type optimized for efficient storage and
deserialization of PatternKey
using the ZeroVec
model.
The serialization model packages the pattern item in a single byte.
The first two bits (b7 & b6) determine the variant of the pattern key:
00
:Binary
01
:Decimal
10
:Power
11
: Forbidden
The next 6 bits (b5 to b0) determine the value of the pattern key:
- For
Binary
, the value is mapped directly to the pattern value. - For
Decimal
:- b5 is determining the sign of the value. if b5 is 0, the value is positive. if b5 is 1, the value is negative.
- b4 to b0 are determining the magnitude of the value.
- For
Power
:- b5 and b4 represent the power value, which can be
10
to representTwo
and11
to representThree
. - b3 to b0 represent the count value, which can be:
0000
: Zero0001
: One0010
: Two0011
: Few0100
: Many0101
: Other
- Note: In the
Power
case, b3 is always 0, and when b2 is 1, b1 must be 0.
- b5 and b4 represent the power value, which can be
Trait Implementations§
source§impl Clone for PatternKeyULE
impl Clone for PatternKeyULE
source§fn clone(&self) -> PatternKeyULE
fn clone(&self) -> PatternKeyULE
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PatternKeyULE
impl Debug for PatternKeyULE
source§impl Ord for PatternKeyULE
impl Ord for PatternKeyULE
source§fn cmp(&self, other: &PatternKeyULE) -> Ordering
fn cmp(&self, other: &PatternKeyULE) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for PatternKeyULE
impl PartialEq for PatternKeyULE
source§impl PartialOrd for PatternKeyULE
impl PartialOrd for PatternKeyULE
source§impl ULE for PatternKeyULE
impl ULE for PatternKeyULE
source§fn validate_byte_slice(bytes: &[u8]) -> Result<(), UleError>
fn validate_byte_slice(bytes: &[u8]) -> Result<(), UleError>
Validates a byte slice,
&[u8]
. Read moresource§unsafe fn from_byte_slice_unchecked(bytes: &[u8]) -> &[Self]
unsafe fn from_byte_slice_unchecked(bytes: &[u8]) -> &[Self]
Takes a byte slice,
&[u8]
, and return it as &[Self]
with the same lifetime, assuming
that this byte slice has previously been run through Self::parse_byte_slice()
with
success. Read moreimpl Copy for PatternKeyULE
impl Eq for PatternKeyULE
impl StructuralPartialEq for PatternKeyULE
Auto Trait Implementations§
impl Freeze for PatternKeyULE
impl RefUnwindSafe for PatternKeyULE
impl Send for PatternKeyULE
impl Sync for PatternKeyULE
impl Unpin for PatternKeyULE
impl UnwindSafe for PatternKeyULE
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more