Struct icu_collator::elements::CollationElement32
source · 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”
CollationElement32
s 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: u32
Implementations§
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
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_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 · 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 ==
.