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” 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: u32

Implementations§

source§

impl CollationElement32

source

pub fn new(bits: u32) -> Self

source

pub fn new_from_ule(ule: RawBytesULE<4>) -> Self

source

fn low_byte(&self) -> u8

source

fn tag_checked(&self) -> Option<Tag>

source

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.

source

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.

source

pub fn to_ce_self_contained(self) -> Option<CollationElement>

Expands to 64 bits if the expansion is to a single 64-bit collation element.

source

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.

source

pub fn len(&self) -> usize

Gets the length from this element.

§Panics

In debug builds if this element doesn’t have a length.

source

pub fn index(&self) -> usize

Gets the index from this element.

§Panics

In debug builds if this element doesn’t have an index.

source

pub fn digit(&self) -> u8

source

pub fn every_suffix_starts_with_combining(&self) -> bool

source

pub fn at_least_one_suffix_contains_starter(&self) -> bool

source

pub fn at_least_one_suffix_ends_with_non_starter(&self) -> bool

Trait Implementations§

source§

impl Clone for CollationElement32

source§

fn clone(&self) -> CollationElement32

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CollationElement32

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CollationElement32

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl PartialEq for CollationElement32

source§

fn eq(&self, other: &CollationElement32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for CollationElement32

source§

impl StructuralPartialEq for CollationElement32

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T