pub struct Uts46Mapper { /* private fields */ }
Expand description
A mapper that knows how to performs the subsets of UTS 46 processing documented on the methods.
Implementations§
Source§impl Uts46Mapper
impl Uts46Mapper
Sourcepub fn try_new<D>(provider: &D) -> Result<Self, NormalizerError>
pub fn try_new<D>(provider: &D) -> Result<Self, NormalizerError>
Construct with provider.
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.
Sourcepub fn map_normalize<'delegate, I: Iterator<Item = char> + 'delegate>(
&'delegate self,
iter: I,
) -> impl Iterator<Item = char> + 'delegate
pub fn map_normalize<'delegate, I: Iterator<Item = char> + 'delegate>( &'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: Iterator<Item = char> + 'delegate>(
&'delegate self,
iter: I,
) -> impl Iterator<Item = char> + 'delegate
pub fn normalize_validate<'delegate, I: Iterator<Item = char> + 'delegate>( &'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 Debug for Uts46Mapper
impl Debug for Uts46Mapper
Auto Trait Implementations§
impl Freeze for Uts46Mapper
impl RefUnwindSafe for Uts46Mapper
impl !Send for Uts46Mapper
impl !Sync for Uts46Mapper
impl Unpin for Uts46Mapper
impl UnwindSafe for Uts46Mapper
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