pub struct CaseMapper { /* 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.
Most methods for this type live on CaseMapperBorrowed
, which you can obtain via
CaseMapper::new()
or CaseMapper::as_borrowed()
.
§Examples
use icu::casemap::CaseMapper;
use icu::locale::langid;
let cm = CaseMapper::new();
assert_eq!(
cm.uppercase_to_string("hello world", &langid!("und")),
"HELLO WORLD"
);
assert_eq!(
cm.lowercase_to_string("Γειά σου Κόσμε", &langid!("und")),
"γειά σου κόσμε"
);
Implementations§
Source§impl CaseMapper
impl CaseMapper
Sourcepub const fn new() -> CaseMapperBorrowed<'static>
pub const fn new() -> CaseMapperBorrowed<'static>
Creates a CaseMapperBorrowed
using compiled data.
✨ Enabled with the compiled_data
Cargo feature.
§Examples
use icu::casemap::CaseMapper;
use icu::locale::langid;
let cm = CaseMapper::new();
assert_eq!(
cm.uppercase_to_string("hello world", &langid!("und")),
"HELLO WORLD"
);
Sourcepub fn as_borrowed(&self) -> CaseMapperBorrowed<'_>
pub fn as_borrowed(&self) -> CaseMapperBorrowed<'_>
Constructs a borrowed version of this type for more efficient querying.
Sourcepub fn try_new_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
) -> Result<Self, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), ) -> Result<Self, DataError>
A version of [Self :: new
] that uses custom data provided by a BufferProvider
.
✨ Enabled with the serde
feature.
Sourcepub fn try_new_unstable<P>(provider: &P) -> Result<CaseMapper, DataError>
pub fn try_new_unstable<P>(provider: &P) -> Result<CaseMapper, DataError>
A version of Self::new
that uses custom data provided by a DataProvider
.
⚠️ The bounds on provider may change over time, including in SemVer minor releases.
Trait Implementations§
Source§impl AsRef<CaseMapper> for CaseMapper
impl AsRef<CaseMapper> for CaseMapper
Source§fn as_ref(&self) -> &CaseMapper
fn as_ref(&self) -> &CaseMapper
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for CaseMapper
impl Clone for CaseMapper
Source§fn clone(&self) -> CaseMapper
fn clone(&self) -> CaseMapper
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for CaseMapper
impl RefUnwindSafe for CaseMapper
impl Send for CaseMapper
impl Sync for CaseMapper
impl Unpin for CaseMapper
impl UnwindSafe for CaseMapper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more