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
sourceimpl 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<CaseMapping, Error>
pub fn try_from_icu(
trie_header: CodePointTrieHeader,
trie_index: &[u16],
trie_data: &[u16],
exceptions: &[u16],
unfold: &[u16]
) -> Result<CaseMapping, 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
sourceimpl Clone for CaseMapping
impl Clone for CaseMapping
sourcefn clone(&self) -> CaseMapping
fn clone(&self) -> CaseMapping
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for CaseMapping
impl Send for CaseMapping
impl Sync for CaseMapping
impl Unpin for CaseMapping
impl UnwindSafe for CaseMapping
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more