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.
Source§impl Uts46MapperBorrowed<'_>
impl Uts46MapperBorrowed<'_>
Sourcepub fn is_virama(&self, c: char) -> bool
pub fn is_virama(&self, c: char) -> bool
Returns true iff the canonical combining class of c is 9 (Virama).
This method uses the UTS 46 data and does not add a dependency on NFD
data like CanonicalCombiningClassMapBorrowed does.
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
ignoredcharacters are ignored. - The
mappedcharacters are mapped. - The
disallowedcharacters are replaced with U+FFFD, which itself is a disallowed character. - The
deviationcharacters are treated asmappedorvalidas appropriate. - The
disallowed_STD3_validcharacters are treated as allowed. - The
disallowed_STD3_mappedcharacters are treated asmapped. - 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
ignoredcharacters are treated asdisallowed. - The
mappedcharacters are mapped. - The
disallowedcharacters are replaced with U+FFFD, which itself is a disallowed character. - The
deviationcharacters are treated asmappedorvalidas appropriate. - The
disallowed_STD3_validcharacters are treated as allowed. - The
disallowed_STD3_mappedcharacters are treated asmapped. - 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.