Struct icu::normalizer::properties::CanonicalCompositionBorrowed
source · pub struct CanonicalCompositionBorrowed<'a> { /* private fields */ }
Expand description
Borrowed version of the raw canonical composition operation.
Callers should generally use ComposingNormalizer
instead of this API.
However, this API is provided for callers such as HarfBuzz that specifically
want access to the raw canonical composition operation e.g. for use in a
glyph-availability-guided custom normalizer.
Implementations§
source§impl CanonicalCompositionBorrowed<'static>
impl CanonicalCompositionBorrowed<'static>
sourcepub const fn static_to_owned(self) -> CanonicalComposition
pub const fn static_to_owned(self) -> CanonicalComposition
Cheaply converts a [CanonicalCompositionBorrowed<'static>
] into a CanonicalComposition
.
Note: Due to branching and indirection, using CanonicalComposition
might inhibit some
compile-time optimizations that are possible with CanonicalCompositionBorrowed
.
sourcepub const fn new() -> CanonicalCompositionBorrowed<'static>
pub const fn new() -> CanonicalCompositionBorrowed<'static>
Constructs a new CanonicalComposition
using compiled data.
✨ Enabled with the compiled_data
Cargo feature.
source§impl CanonicalCompositionBorrowed<'_>
impl CanonicalCompositionBorrowed<'_>
sourcepub fn compose(&self, starter: char, second: char) -> Option<char>
pub fn compose(&self, starter: char, second: char) -> Option<char>
Performs canonical composition (including Hangul) on a pair of
characters or returns None
if these characters don’t compose.
Composition exclusions are taken into account.
§Examples
let comp = icu::normalizer::properties::CanonicalCompositionBorrowed::new();
assert_eq!(comp.compose('a', 'b'), None); // Just two non-composing starters
assert_eq!(comp.compose('a', '\u{0308}'), Some('ä'));
assert_eq!(comp.compose('ẹ', '\u{0302}'), Some('ệ'));
assert_eq!(comp.compose('𝅗', '𝅥'), None); // Composition exclusion
assert_eq!(comp.compose('ে', 'া'), Some('ো')); // Second is starter
assert_eq!(comp.compose('ᄀ', 'ᅡ'), Some('가')); // Hangul LV
assert_eq!(comp.compose('가', 'ᆨ'), Some('각')); // Hangul LVT
Trait Implementations§
source§impl<'a> Debug for CanonicalCompositionBorrowed<'a>
impl<'a> Debug for CanonicalCompositionBorrowed<'a>
source§impl Default for CanonicalCompositionBorrowed<'static>
impl Default for CanonicalCompositionBorrowed<'static>
source§fn default() -> CanonicalCompositionBorrowed<'static>
fn default() -> CanonicalCompositionBorrowed<'static>
Auto Trait Implementations§
impl<'a> Freeze for CanonicalCompositionBorrowed<'a>
impl<'a> RefUnwindSafe for CanonicalCompositionBorrowed<'a>
impl<'a> Send for CanonicalCompositionBorrowed<'a>
impl<'a> Sync for CanonicalCompositionBorrowed<'a>
impl<'a> Unpin for CanonicalCompositionBorrowed<'a>
impl<'a> UnwindSafe for CanonicalCompositionBorrowed<'a>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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