Struct icu::normalizer::uts46::Uts46MapperBorrowed
source · pub struct Uts46MapperBorrowed<'a> { /* private fields */ }
Expand description
A borrowed version of a mapper that knows how to performs the subsets of UTS 46 processing documented on the methods.
Implementations§
source§impl Uts46MapperBorrowed<'static>
impl Uts46MapperBorrowed<'static>
sourcepub const fn static_to_owned(self) -> Uts46Mapper
pub const fn static_to_owned(self) -> Uts46Mapper
Cheaply converts a [Uts46MapperBorrowed<'static>
] into a Uts46Mapper
.
Note: Due to branching and indirection, using Uts46Mapper
might inhibit some
compile-time optimizations that are possible with Uts46MapperBorrowed
.
sourcepub const fn new() -> Uts46MapperBorrowed<'static>
pub const fn new() -> Uts46MapperBorrowed<'static>
Construct with compiled data.
source§impl Uts46MapperBorrowed<'_>
impl Uts46MapperBorrowed<'_>
sourcepub fn map_normalize<'delegate, I>(
&'delegate self,
iter: I,
) -> impl Iterator<Item = char> + 'delegate
pub fn map_normalize<'delegate, I>( &'delegate self, iter: I, ) -> impl Iterator<Item = char> + 'delegate
Returns an iterator adaptor that turns an Iterator
over char
into an iterator yielding a char
sequence that gets the following
operations from the “Map” and “Normalize” steps of the “Processing”
section of UTS 46 lazily applied to it:
- The ignored characters are ignored.
- The mapped characters are mapped.
- The disallowed characters are replaced with U+FFFD, which itself is a disallowed character.
- The deviation characters are treated as mapped or valid as appropriate.
- The disallowed_STD3_valid characters are treated as allowed.
- The disallowed_STD3_mapped characters are treated as mapped.
- The result is normalized to NFC.
Notably:
- The STD3 or WHATWG ASCII deny list should be implemented as a post-processing step.
- Transitional processing is not performed. Transitional mapping would be a pre-processing step, but transitional processing is deprecated, and none of Firefox, Safari, or Chrome use it.
sourcepub fn normalize_validate<'delegate, I>(
&'delegate self,
iter: I,
) -> impl Iterator<Item = char> + 'delegate
pub fn normalize_validate<'delegate, I>( &'delegate self, iter: I, ) -> impl Iterator<Item = char> + 'delegate
Returns an iterator adaptor that turns an Iterator
over char
into an iterator yielding a char
sequence that gets the following
operations from the NFC check and statucs steps of the “Validity
Criteria” section of UTS 46 lazily applied to it:
- The ignored characters are treated as disallowed.
- The mapped characters are mapped.
- The disallowed characters are replaced with U+FFFD, which itself is a disallowed character.
- The deviation characters are treated as mapped or valid as appropriate.
- The disallowed_STD3_valid characters are treated as allowed.
- The disallowed_STD3_mapped characters are treated as mapped.
- The result is normalized to NFC.
Notably:
- The STD3 or WHATWG ASCII deny list should be implemented as a post-processing step.
- Transitional processing is not performed. Transitional mapping would be a pre-processing step, but transitional processing is deprecated, and none of Firefox, Safari, or Chrome use it.
- The output needs to be compared with input to see if anything changed. This check catches failures to adhere to the normalization and status requirements. In particular, this comparison results in mapped characters resulting in error like “Validity Criteria” requires.
Trait Implementations§
source§impl<'a> Debug for Uts46MapperBorrowed<'a>
impl<'a> Debug for Uts46MapperBorrowed<'a>
source§impl Default for Uts46MapperBorrowed<'static>
impl Default for Uts46MapperBorrowed<'static>
source§fn default() -> Uts46MapperBorrowed<'static>
fn default() -> Uts46MapperBorrowed<'static>
Auto Trait Implementations§
impl<'a> Freeze for Uts46MapperBorrowed<'a>
impl<'a> RefUnwindSafe for Uts46MapperBorrowed<'a>
impl<'a> Send for Uts46MapperBorrowed<'a>
impl<'a> Sync for Uts46MapperBorrowed<'a>
impl<'a> Unpin for Uts46MapperBorrowed<'a>
impl<'a> UnwindSafe for Uts46MapperBorrowed<'a>
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> 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