Struct icu_collator::options::CollatorOptionsBitField

source ·
pub(crate) struct CollatorOptionsBitField(u32);

Tuple Fields§

§0: u32

Implementations§

source§

impl CollatorOptionsBitField

source

const STRENGTH_MASK: u32 = 7u32

Bits 0..2 : Strength

source

const ALTERNATE_HANDLING_MASK: u32 = 8u32

Bits 3..4 : Alternate handling: 00 non-ignorable, 01 shifted, 10 reserved for shift-trimmed, 11 reserved for blanked. In other words, bit 4 is currently always 0.

source

const MAX_VARIABLE_MASK: u32 = 96u32

Bits 5..6 : 2-bit max variable value to be shifted by MAX_VARIABLE_SHIFT.

source

const MAX_VARIABLE_SHIFT: u32 = 5u32

source

const UPPER_FIRST_MASK: u32 = 256u32

Bit 7 : Reserved for extending max variable. Bit 8 : Sort uppercase first if case level or case first is on.

source

const CASE_FIRST_MASK: u32 = 512u32

Bit 9 : Keep the case bits in the tertiary weight (they trump other tertiary values) unless case level is on (when they are moved into the separate case level). By default, the case bits are removed from the tertiary weight (ignored). When CASE_FIRST is off, UPPER_FIRST must be off too, corresponding to the tri-value UCOL_CASE_FIRST attribute: UCOL_OFF vs. UCOL_LOWER_FIRST vs. UCOL_UPPER_FIRST.

source

const CASE_LEVEL_MASK: u32 = 1_024u32

Bit 10 : Insert the case level between the secondary and tertiary levels.

source

const BACKWARD_SECOND_LEVEL_MASK: u32 = 2_048u32

Bit 11 : Backward secondary level

source

const NUMERIC_MASK: u32 = 4_096u32

Bit 12 : Numeric

source

const EXPLICIT_STRENGTH_MASK: u32 = 2_147_483_648u32

Whether strength is explicitly set.

source

const EXPLICIT_MAX_VARIABLE_MASK: u32 = 1_073_741_824u32

Whether max variable is explicitly set.

source

const EXPLICIT_ALTERNATE_HANDLING_MASK: u32 = 536_870_912u32

Whether alternate handling is explicitly set.

source

const EXPLICIT_CASE_LEVEL_MASK: u32 = 268_435_456u32

Whether case level is explicitly set.

source

const EXPLICIT_CASE_FIRST_MASK: u32 = 134_217_728u32

Whether case first is explicitly set.

source

const EXPLICIT_BACKWARD_SECOND_LEVEL_MASK: u32 = 67_108_864u32

Whether backward secondary is explicitly set.

source

const EXPLICIT_NUMERIC_MASK: u32 = 33_554_432u32

Whether numeric is explicitly set.

source

pub const fn new() -> Self

Create a new CollatorOptionsBitField with the defaults.

source

pub fn strength(&self) -> Strength

This is the BCP47 key ks.

source

pub fn set_strength(&mut self, strength: Option<Strength>)

This is the BCP47 key ks. See the enum for examples.

source

pub fn max_variable(&self) -> MaxVariable

The maximum character class that AlternateHandling::Shifted applies to.

source

pub fn set_max_variable(&mut self, max_variable: Option<MaxVariable>)

The maximum character class that AlternateHandling::Shifted applies to. See the enum for examples.

source

pub fn alternate_handling(&self) -> AlternateHandling

Whether certain characters are moved from the primary level to the quaternary level.

source

pub fn set_alternate_handling( &mut self, alternate_handling: Option<AlternateHandling>, )

Whether certain characters are moved from the primary level to the quaternary level. See the enum for examples.

source

pub fn case_level(&self) -> bool

Whether there’s a dedicated case level.

source

pub fn set_case_level(&mut self, case_level: Option<bool>)

Whether there’s a dedicated case level. If true, detaches the case aspect of the tertiary level and inserts it between the secondary and tertiary levels. Can be combined with the primary-only strength. Setting this to true with Strength::Primary corresponds to the ECMA-402 sensitivity “case”.

See the ICU guide.

source

pub fn set_case_level_from_enum(&mut self, case_level: Option<CaseLevel>)

source

fn case_first(&self) -> CaseFirst

source

pub fn set_case_first(&mut self, case_first: Option<CaseFirst>)

Whether case is the most significant part of the tertiary level.

See the ICU guide.

source

pub fn backward_second_level(&self) -> bool

Whether second level compares the last accent difference instead of the first accent difference.

source

pub fn set_backward_second_level(&mut self, backward_second_level: Option<bool>)

Whether second level compares the last accent difference instead of the first accent difference.

source

pub fn set_backward_second_level_from_enum( &mut self, backward_second_level: Option<BackwardSecondLevel>, )

source

pub fn numeric(&self) -> bool

Whether sequences of decimal digits are compared according to their numeric value.

source

pub fn set_numeric(&mut self, numeric: Option<bool>)

Whether sequences of decimal digits are compared according to their numeric value.

source

pub fn set_numeric_from_enum(&mut self, numeric: Option<Numeric>)

source

pub(crate) fn tertiary_mask(&self) -> Option<u16>

If strength is <= secondary, returns None. Otherwise, returns the appropriate mask.

source

pub(crate) fn upper_first(&self) -> bool

Internal upper first getter

source

pub fn set_defaults(&mut self, other: CollatorOptionsBitField)

For options left as defaults in this CollatorOptions, set the value from other. Values taken from other are marked as explicitly set if they were explicitly set in other.

Trait Implementations§

source§

impl Clone for CollatorOptionsBitField

source§

fn clone(&self) -> CollatorOptionsBitField

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 CollatorOptionsBitField

source§

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

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

impl From<CollatorOptions> for CollatorOptionsBitField

source§

fn from(options: CollatorOptions) -> CollatorOptionsBitField

Converts to this type from the input type.
source§

impl From<CollatorOptionsBitField> for ResolvedCollatorOptions

source§

fn from(options: CollatorOptionsBitField) -> ResolvedCollatorOptions

Converts to this type from the input type.
source§

impl Copy for CollatorOptionsBitField

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> 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,

§

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>,

§

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>,

§

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