pub struct UCollator { /* private fields */ }

Implementations§

source§

impl UCollator

source

pub fn strcoll(&self, first: &UChar, second: &UChar) -> Ordering

Compares strings first and second according to the collation rules in this collator.

Returns Ordering::Less if first compares as less than second, and for other return codes respectively.

Implements ucol_strcoll

source

pub fn get_sort_key(&self, source: &UChar) -> Vec<u8>

Get a sort key for a string from this collator.

Returns a sort key.

Implements ucol_getSortKey

source

pub fn strcoll_utf8( &self, first: impl AsRef<str>, second: impl AsRef<str> ) -> Result<Ordering, Error>

Compares strings first and second according to the collation rules in this collator.

Returns Ordering::Less if first compares as less than second, and for other return codes respectively.

In contrast to UCollator::strcoll, this function requires no string conversions to compare two rust strings.

Implements ucol_strcoll Implements ucol_strcollUTF8

source

pub fn get_strength(&self) -> UCollationStrength

Implements ucol_getStrength.

source

pub fn set_strength(&mut self, strength: UCollationStrength)

Implements ucol_setStrength

source

pub fn set_max_variable( &self, max_variable: UColReorderCode ) -> Result<(), Error>

Implements ucol_setMaxVariable.

source

pub fn set_attribute( &self, attr: UColAttribute, value: UColAttributeValue ) -> Result<(), Error>

Implements ucol_setAttribute.

source

pub fn get_attribute( &self, attr: UColAttribute ) -> Result<UColAttributeValue, Error>

Implements ucol_getAttribute.

Trait Implementations§

source§

impl Debug for UCollator

source§

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

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

impl Drop for UCollator

source§

fn drop(&mut self)

Implements ucol_close.

source§

impl TryFrom<&str> for UCollator

source§

fn try_from(locale: &str) -> Result<UCollator, Self::Error>

Makes a new collator from the supplied locale, e.g. en-US, or de@collation=phonebook.

Other examples:

  • el-u-kf-upper
  • el@colCaseFirst=upper

Implements ucol_open

§

type Error = Error

The type returned in the event of a conversion error.

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