pub struct CaseMapCloser<CM> { /* private fields */ }
Expand description
A wrapper around CaseMapper
that can produce case mapping closures
over a character or string. This wrapper can be constructed directly, or
by wrapping a reference to an existing CaseMapper
.
Most methods for this type live on CaseMapCloserBorrowed
, which you can obtain via
CaseMapCloser::new()
or CaseMapCloser::as_borrowed()
.
§Examples
use icu::casemap::CaseMapCloser;
use icu::collections::codepointinvlist::CodePointInversionListBuilder;
let cm = CaseMapCloser::new();
let mut builder = CodePointInversionListBuilder::new();
let found = cm.add_string_case_closure_to("ffi", &mut builder);
assert!(found);
let set = builder.build();
assert!(set.contains('ffi'));
let mut builder = CodePointInversionListBuilder::new();
let found = cm.add_string_case_closure_to("ss", &mut builder);
assert!(found);
let set = builder.build();
assert!(set.contains('ß'));
assert!(set.contains('ẞ'));
Implementations§
Source§impl CaseMapCloser<CaseMapper>
impl CaseMapCloser<CaseMapper>
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<Self, DataError>
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
A version of Self::new
that uses custom data provided by a DataProvider
.
Source§impl CaseMapCloser<CaseMapper>
impl CaseMapCloser<CaseMapper>
Sourcepub const fn new() -> CaseMapCloserBorrowed<'static>
pub const fn new() -> CaseMapCloserBorrowed<'static>
A constructor which creates a CaseMapCloserBorrowed
using compiled data.
§Examples
use icu::casemap::CaseMapCloser;
use icu::collections::codepointinvlist::CodePointInversionListBuilder;
let cm = CaseMapCloser::new();
let mut builder = CodePointInversionListBuilder::new();
let found = cm.add_string_case_closure_to("ffi", &mut builder);
assert!(found);
let set = builder.build();
assert!(set.contains('ffi'));
let mut builder = CodePointInversionListBuilder::new();
let found = cm.add_string_case_closure_to("ss", &mut builder);
assert!(found);
let set = builder.build();
assert!(set.contains('ß'));
assert!(set.contains('ẞ'));
✨ Enabled with the compiled_data
Cargo feature.
Source§impl<CM: AsRef<CaseMapper>> CaseMapCloser<CM>
impl<CM: AsRef<CaseMapper>> CaseMapCloser<CM>
Sourcepub fn try_new_with_mapper_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
casemapper: CM,
) -> Result<Self, DataError>
pub fn try_new_with_mapper_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), casemapper: CM, ) -> Result<Self, DataError>
A version of [Self :: new_with_mapper
] that uses custom data provided by a BufferProvider
.
✨ Enabled with the serde
feature.
Sourcepub const fn new_with_mapper(casemapper: CM) -> Self
pub const fn new_with_mapper(casemapper: CM) -> Self
A constructor which creates a CaseMapCloser
from an existing CaseMapper
(either owned or as a reference)
✨ Enabled with the compiled_data
Cargo feature.
Sourcepub fn try_new_with_mapper_unstable<P>(
provider: &P,
casemapper: CM,
) -> Result<Self, DataError>
pub fn try_new_with_mapper_unstable<P>( provider: &P, casemapper: CM, ) -> Result<Self, DataError>
Construct this object to wrap an existing CaseMapper (or a reference to one), loading additional data as needed.
A version of Self::new_with_mapper
that uses custom data provided by a DataProvider
.
Sourcepub fn as_borrowed(&self) -> CaseMapCloserBorrowed<'_>
pub fn as_borrowed(&self) -> CaseMapCloserBorrowed<'_>
Constructs a borrowed version of this type for more efficient querying.
Trait Implementations§
Source§impl<CM: Clone> Clone for CaseMapCloser<CM>
impl<CM: Clone> Clone for CaseMapCloser<CM>
Source§fn clone(&self) -> CaseMapCloser<CM>
fn clone(&self) -> CaseMapCloser<CM>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<CM> Freeze for CaseMapCloser<CM>where
CM: Freeze,
impl<CM> RefUnwindSafe for CaseMapCloser<CM>where
CM: RefUnwindSafe,
impl<CM> Send for CaseMapCloser<CM>where
CM: Send,
impl<CM> Sync for CaseMapCloser<CM>where
CM: Sync,
impl<CM> Unpin for CaseMapCloser<CM>where
CM: Unpin,
impl<CM> UnwindSafe for CaseMapCloser<CM>where
CM: UnwindSafe,
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
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>
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>
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