icu_normalizer::uts46

Struct Uts46Mapper

Source
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

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