Struct icu_normalizer::properties::CanonicalComposition
source · pub struct CanonicalComposition {
canonical_compositions: DataPayload<CanonicalCompositionsV1Marker>,
}
Expand description
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.
Fields§
§canonical_compositions: DataPayload<CanonicalCompositionsV1Marker>
Implementations§
source§impl CanonicalComposition
impl CanonicalComposition
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::CanonicalComposition::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
sourcepub const fn new() -> Self
pub const fn new() -> Self
Constructs a new CanonicalComposition
using compiled data.
✨ Enabled with the compiled_data
Cargo feature.
sourcepub fn try_new_with_any_provider(
provider: &(impl AnyProvider + ?Sized),
) -> Result<Self, NormalizerError>
pub fn try_new_with_any_provider( provider: &(impl AnyProvider + ?Sized), ) -> Result<Self, NormalizerError>
A version of Self::new
that uses custom data provided by an AnyProvider
.
sourcepub fn try_new_unstable<D>(provider: &D) -> Result<Self, NormalizerError>
pub fn try_new_unstable<D>(provider: &D) -> Result<Self, NormalizerError>
A version of Self::new
that uses custom data provided by a DataProvider
.
⚠️ The bounds on provider may change over time, including in SemVer minor releases.
Trait Implementations§
source§impl Debug for CanonicalComposition
impl Debug for CanonicalComposition
Auto Trait Implementations§
impl Freeze for CanonicalComposition
impl RefUnwindSafe for CanonicalComposition
impl !Send for CanonicalComposition
impl !Sync for CanonicalComposition
impl Unpin for CanonicalComposition
impl UnwindSafe for CanonicalComposition
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
Mutably borrows from an owned value. Read more