Struct icu_properties::bidi::BidiClassAdapter
source · pub struct BidiClassAdapter<'a> {
data: CodePointMapDataBorrowed<'a, BidiClass>,
}
Expand description
An adapter to convert from icu4x BidiClass
to unicode_bidi::BidiClass
.
✨ Enabled with the bidi
Cargo feature.
§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 adapter = BidiClassAdapter::new(maps::bidi_class());
assert_eq!(adapter.bidi_class('a'), DataSourceBidiClass::L);
assert_eq!(adapter.bidi_class('ع'), DataSourceBidiClass::AL);
Fields§
§data: CodePointMapDataBorrowed<'a, BidiClass>
Implementations§
source§impl<'a> BidiClassAdapter<'a>
impl<'a> BidiClassAdapter<'a>
sourcepub const fn new(
data: CodePointMapDataBorrowed<'a, BidiClass>,
) -> BidiClassAdapter<'a>
pub const fn new( data: CodePointMapDataBorrowed<'a, BidiClass>, ) -> BidiClassAdapter<'a>
Creates new instance of BidiClassAdapter
.
Trait Implementations§
source§impl<'a> BidiDataSource for BidiClassAdapter<'a>
impl<'a> BidiDataSource for BidiClassAdapter<'a>
source§fn bidi_class(&self, c: char) -> DataSourceBidiClass
fn bidi_class(&self, c: char) -> DataSourceBidiClass
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 adapter = BidiClassAdapter::new(maps::bidi_class());
assert_eq!(adapter.bidi_class('a'), DataSourceBidiClass::L);
source§fn bidi_matched_opening_bracket(
&self,
c: char,
) -> Option<BidiMatchedOpeningBracket>
fn bidi_matched_opening_bracket( &self, c: char, ) -> Option<BidiMatchedOpeningBracket>
If this character is a bracket according to BidiBrackets.txt,
return the corresponding normalized opening bracket of the pair,
and whether or not it itself is an opening bracket. Read more
Auto Trait Implementations§
impl<'a> Freeze for BidiClassAdapter<'a>
impl<'a> RefUnwindSafe for BidiClassAdapter<'a>
impl<'a> Send for BidiClassAdapter<'a>
impl<'a> Sync for BidiClassAdapter<'a>
impl<'a> Unpin for BidiClassAdapter<'a>
impl<'a> UnwindSafe for BidiClassAdapter<'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
Mutably borrows from an owned value. Read more