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:Binary01:Decimal10:Power11: 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
10to representTwoand11to representThree. - b3 to b0 represent the count value, which can be:
0000: Zero0001: One0010: Two0011: Few0100: Many0101: Other
- Note: In the
Powercase, 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
impl Copy for PatternKeyULE
Source§impl Debug for PatternKeyULE
impl Debug for PatternKeyULE
impl Eq for PatternKeyULE
Source§impl Ord for PatternKeyULE
impl Ord for PatternKeyULE
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for PatternKeyULE
impl PartialEq for PatternKeyULE
Source§impl PartialOrd for PatternKeyULE
impl PartialOrd for PatternKeyULE
impl StructuralPartialEq for PatternKeyULE
Source§impl ULE for PatternKeyULE
impl ULE for PatternKeyULE
Source§fn validate_bytes(bytes: &[u8]) -> Result<(), UleError>
fn validate_bytes(bytes: &[u8]) -> Result<(), UleError>
Validates a byte slice,
&[u8]. Read moreSource§unsafe fn slice_from_bytes_unchecked(bytes: &[u8]) -> &[Self]
unsafe fn slice_from_bytes_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_bytes_to_slice() with
success. Read moreAuto Trait Implementations§
impl Freeze for PatternKeyULE
impl RefUnwindSafe for PatternKeyULE
impl Send for PatternKeyULE
impl Sync for PatternKeyULE
impl Unpin for PatternKeyULE
impl UnsafeUnpin 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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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