Struct rust_icu_ucol::UCollator
source · pub struct UCollator { /* private fields */ }
Implementations§
source§impl UCollator
impl UCollator
sourcepub fn strcoll(&self, first: &UChar, second: &UChar) -> Ordering
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
sourcepub fn get_sort_key(&self, source: &UChar) -> Vec<u8>
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
sourcepub fn strcoll_utf8(
&self,
first: impl AsRef<str>,
second: impl AsRef<str>
) -> Result<Ordering, Error>
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
sourcepub fn get_strength(&self) -> UCollationStrength
pub fn get_strength(&self) -> UCollationStrength
Implements ucol_getStrength
.
sourcepub fn set_strength(&mut self, strength: UCollationStrength)
pub fn set_strength(&mut self, strength: UCollationStrength)
Implements ucol_setStrength
sourcepub fn set_max_variable(
&self,
max_variable: UColReorderCode
) -> Result<(), Error>
pub fn set_max_variable( &self, max_variable: UColReorderCode ) -> Result<(), Error>
Implements ucol_setMaxVariable
.
sourcepub fn set_attribute(
&self,
attr: UColAttribute,
value: UColAttributeValue
) -> Result<(), Error>
pub fn set_attribute( &self, attr: UColAttribute, value: UColAttributeValue ) -> Result<(), Error>
Implements ucol_setAttribute
.
sourcepub fn get_attribute(
&self,
attr: UColAttribute
) -> Result<UColAttributeValue, Error>
pub fn get_attribute( &self, attr: UColAttribute ) -> Result<UColAttributeValue, Error>
Implements ucol_getAttribute
.