pub struct BidiClassAdapter<'a> { /* private fields */ }
Expand description

An adapter to convert from icu4x BidiClass to unicode_bidi::BidiClass.

Example

use icu_collections::codepointtrie::CodePointTrie;
use icu_properties::bidi::BidiClassAdapter;
use icu_properties::{maps, BidiClass};
use unicode_bidi::BidiClass as DataSourceBidiClass;
use unicode_bidi::BidiDataSource;

let data = maps::load_bidi_class(&icu_testdata::unstable())
    .expect("The data should be valid");

let adapter = BidiClassAdapter::new(data.as_borrowed());
assert_eq!(adapter.bidi_class('a'), DataSourceBidiClass::L);
assert_eq!(adapter.bidi_class('ع'), DataSourceBidiClass::AL);

Implementations

Creates new instance of BidiClassAdapter.

Trait Implementations

Returns a [DataSourceBidiClass] given a unicode character.

Example
use icu_collections::codepointtrie::CodePointTrie;
use icu_properties::bidi::BidiClassAdapter;
use icu_properties::{maps, BidiClass};
use unicode_bidi::BidiClass as DataSourceBidiClass;
use unicode_bidi::BidiDataSource;

let data = maps::load_bidi_class(&icu_testdata::unstable())
    .expect("The data should be valid");

let adapter = BidiClassAdapter::new(data.as_borrowed());
assert_eq!(adapter.bidi_class('a'), DataSourceBidiClass::L);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.