pub(crate) struct CollationElement32(u32);Expand description
A compressed form of a collation element as stored in the collation data.
A CollationElement32 can be “normal” or “special”.
Bits 7 and 6 are case bits for the “normal” case and setting
both is an impossible case bit combination. Hence, “special”
CollationElement32s are marked by setting both case bits
to 1. This is equivalent with the low byte being less than
SPECIAL_CE32_LOW_BYTE (0xC0, i.e. 0b11000000) in the “normal”
case and equal to or greater in the “special” case.
For the normal case: Bits: 31..16: Primary weight Bits: 15..8: Secondary weight Bits: 7..6: Case bits (cannot both be 1 simultaneously) Bits: 5..0: The high part of the discontiguous tertiary weight (The quaternary weight and the low part of the discontiguous tertiary weight are zero.)
For the special case:
Bits 31..8: tag-specific; see the documentation for Tag.
Bits 7..6: The specialness marker; both bits set to 1
Bits 5..4: Reserved. May be used in the future to indicate lccc!=0 and tccc!=0.
Bits 3..0: the tag (bit-compatible with Tag)
Tuple Fields§
§0: u32Implementations§
Source§impl CollationElement32
impl CollationElement32
pub fn new(bits: u32) -> Self
pub fn new_from_ule(ule: RawBytesULE<4>) -> Self
fn low_byte(self) -> u8
pub(crate) fn tag_checked(self) -> Option<Tag>
Sourcepub(crate) fn tag(self) -> Tag
pub(crate) fn tag(self) -> Tag
Returns the tag if this element is special.
Non-specialness should first be checked by seeing if either
to_ce_simple_or_long_primary() or to_ce_self_contained()
returns non-None.
§Panics
Panics in debug mode if called on a non-special element.
Sourcepub fn to_primary_simple(self) -> Option<u32>
pub fn to_primary_simple(self) -> Option<u32>
Simplest possible check for the Latin1 fast path.
Sourcepub fn to_primary_in_quick_check(self, data: &CollationData<'_>) -> Option<u32>
pub fn to_primary_in_quick_check(self, data: &CollationData<'_>) -> Option<u32>
Extract only the first primary in the quick check without identical prefix.
Sourcepub fn to_primary_in_quick_check_numeric(
self,
data: &CollationData<'_>,
numeric: bool,
) -> Option<u32>
pub fn to_primary_in_quick_check_numeric( self, data: &CollationData<'_>, numeric: bool, ) -> Option<u32>
Extract only the first primary in the quick check after the identical
prefix. Unlike to_primary_in_quick_check, this method variant can
handle Tag::Digit if the numeric mode is not enabled. (The numeric
mode requires looking ahead.)
Sourcepub fn to_ce_simple_or_long_primary(self) -> Option<CollationElement>
pub fn to_ce_simple_or_long_primary(self) -> Option<CollationElement>
Expands to 64 bits if the expansion is to a single 64-bit collation element and is not a long-secondary expansion.
Sourcepub fn to_ce_self_contained(self) -> Option<CollationElement>
pub fn to_ce_self_contained(self) -> Option<CollationElement>
Expands to 64 bits if the expansion is to a single 64-bit collation element.
Sourcepub fn to_ce_self_contained_or_gigo(self) -> CollationElement
pub fn to_ce_self_contained_or_gigo(self) -> CollationElement
Expands to 64 bits if the expansion is to a single 64-bit collation element or otherwise returns the collation element for U+FFFD.
pub fn digit(self) -> u8
pub fn every_suffix_starts_with_combining(self) -> bool
pub fn at_least_one_suffix_contains_starter(self) -> bool
pub fn at_least_one_suffix_ends_with_non_starter(self) -> bool
Trait Implementations§
Source§impl Clone for CollationElement32
impl Clone for CollationElement32
Source§fn clone(&self) -> CollationElement32
fn clone(&self) -> CollationElement32
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CollationElement32
impl Debug for CollationElement32
Source§impl Default for CollationElement32
impl Default for CollationElement32
Source§impl PartialEq for CollationElement32
impl PartialEq for CollationElement32
Source§fn eq(&self, other: &CollationElement32) -> bool
fn eq(&self, other: &CollationElement32) -> bool
self and other values to be equal, and is used by ==.