Struct icu_casemapping::CaseMapping
source · pub struct CaseMapping { /* private fields */ }
Expand description
A struct with the ability to convert characters and strings to uppercase or lowercase, or fold them to a normalized form for case-insensitive comparison.
Implementations§
source§impl CaseMapping
impl CaseMapping
sourcepub fn try_new<P>(provider: &P) -> Result<CaseMapping, DataError>where
P: DataProvider<CaseMappingV1Marker> + ?Sized,
pub fn try_new<P>(provider: &P) -> Result<CaseMapping, DataError>where P: DataProvider<CaseMappingV1Marker> + ?Sized,
A constructor which takes a DataProvider
and creates a CaseMapping
.
TODO before stabilitzation: make this return a crate-scoped error.
sourcepub fn try_new_with_locale<P>(
provider: &P,
locale: &Locale
) -> Result<CaseMapping, DataError>where
P: DataProvider<CaseMappingV1Marker> + ?Sized,
pub fn try_new_with_locale<P>( provider: &P, locale: &Locale ) -> Result<CaseMapping, DataError>where P: DataProvider<CaseMappingV1Marker> + ?Sized,
A constructor which takes a DataProvider
and creates a CaseMapping
for the given locale.
TODO before stabilitzation: make this return a crate-scoped error.
sourcepub fn try_from_icu(
trie_header: CodePointTrieHeader,
trie_index: &[u16],
trie_data: &[u16],
exceptions: &[u16],
unfold: &[u16]
) -> Result<Self, Error>
pub fn try_from_icu( trie_header: CodePointTrieHeader, trie_index: &[u16], trie_data: &[u16], exceptions: &[u16], unfold: &[u16] ) -> Result<Self, Error>
Creates a new CaseMapping using data exported by the icuexportdata
tool
in ICU4C. Validates that the data is consistent.
sourcepub fn to_lowercase(&self, c: char) -> char
pub fn to_lowercase(&self, c: char) -> char
Returns the lowercase mapping of the given char
.
This function only implements simple and common mappings. Full mappings,
which can map one char
to a string, are not included.
For full mappings, use CaseMapping::to_full_lowercase
.
sourcepub fn to_uppercase(&self, c: char) -> char
pub fn to_uppercase(&self, c: char) -> char
Returns the uppercase mapping of the given char
.
This function only implements simple and common mappings. Full mappings,
which can map one char
to a string, are not included.
For full mappings, use CaseMapping::to_full_uppercase
.
sourcepub fn to_titlecase(&self, c: char) -> char
pub fn to_titlecase(&self, c: char) -> char
Returns the titlecase mapping of the given char
.
This function only implements simple and common mappings. Full mappings,
which can map one char
to a string, are not included.
sourcepub fn fold(&self, c: char) -> char
pub fn fold(&self, c: char) -> char
Returns the simple case folding mapping of the given char.
For full mappings, use CaseMapping::full_fold
.
sourcepub fn fold_turkic(&self, c: char) -> char
pub fn fold_turkic(&self, c: char) -> char
Returns the simple case folding mapping of the given char, using Turkic (T) mappings for
dotted/dotless i. This function does not fold i
and I
to the same character. Instead,
I
will fold to ı
, and İ
will fold to i
. Otherwise, this is the same as
CaseMapping::fold()
.
sourcepub fn to_full_lowercase(&self, src: &str) -> String
pub fn to_full_lowercase(&self, src: &str) -> String
Returns the full lowercase mapping of the given string. This function is context and locale sensitive.
sourcepub fn to_full_uppercase(&self, src: &str) -> String
pub fn to_full_uppercase(&self, src: &str) -> String
Returns the full uppercase mapping of the given string. This function is context and locale sensitive.
sourcepub fn full_fold(&self, src: &str) -> String
pub fn full_fold(&self, src: &str) -> String
Case-folds the characters in the given string. This function is locale-independent and context-insensitive.
sourcepub fn full_fold_turkic(&self, src: &str) -> String
pub fn full_fold_turkic(&self, src: &str) -> String
Case-folds the characters in the given string, using Turkic (T) mappings for dotted/dotless I. This function is locale-independent and context-insensitive.
Trait Implementations§
source§impl Clone for CaseMapping
impl Clone for CaseMapping
source§fn clone(&self) -> CaseMapping
fn clone(&self) -> CaseMapping
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more