Struct icu_normalizer::uts46::Uts46Mapper

source ·
pub struct Uts46Mapper {
    normalizer: ComposingNormalizer,
}
Expand description

A mapper that knows how to performs the subsets of UTS 46 processing documented on the methods.

Fields§

§normalizer: ComposingNormalizer

Implementations§

source§

impl Uts46Mapper

source

pub const fn new() -> Self

Construct with compiled data.

source

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.

📚 Help choosing a constructor

⚠️ The bounds on provider may change over time, including in SemVer minor releases.
source

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:

  1. The ignored characters are ignored.
  2. The mapped characters are mapped.
  3. The disallowed characters are replaced with U+FFFD, which itself is a disallowed character.
  4. The deviation characters are treated as mapped or valid as appropriate.
  5. The disallowed_STD3_valid characters are treated as allowed.
  6. The disallowed_STD3_mapped characters are treated as mapped.
  7. 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.
source

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:

  1. The ignored characters are treated as disallowed.
  2. The mapped characters are mapped.
  3. The disallowed characters are replaced with U+FFFD, which itself is a disallowed character.
  4. The deviation characters are treated as mapped or valid as appropriate.
  5. The disallowed_STD3_valid characters are treated as allowed.
  6. The disallowed_STD3_mapped characters are treated as mapped.
  7. 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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Uts46Mapper

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T