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>

source

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

pub const fn new() -> Uts46MapperBorrowed<'static>

Construct with compiled data.

source§

impl Uts46MapperBorrowed<'_>

source

pub fn map_normalize<'delegate, I>( &'delegate self, iter: I, ) -> impl Iterator<Item = char> + 'delegate
where I: 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>( &'delegate self, iter: I, ) -> impl Iterator<Item = char> + 'delegate
where I: 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<'a> Debug for Uts46MapperBorrowed<'a>

source§

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

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

impl Default for Uts46MapperBorrowed<'static>

source§

fn default() -> Uts46MapperBorrowed<'static>

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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
where T: Send + Sync,