ReshaperConfig

Struct ReshaperConfig 

Source
pub struct ReshaperConfig {
    pub language: Language,
    pub delete_harakat: bool,
    pub shift_harakat_position: bool,
    pub delete_tatweel: bool,
    pub support_zwj: bool,
    pub use_unshaped_instead_of_isolated: bool,
    pub support_ligatures: bool,
    pub ligatures: Ligatures,
}
Expand description

The main Config struct for the ArabicReshaper

You can change all kinds of settings about ArabicReshaper using this struct.

Fields§

§language: Language

Supported languages are: Arabic, ArabicV2, Kurdish More languages might be supported soon.

§delete_harakat: bool

Whether to delete the Harakat (Tashkeel) before reshaping or not.

§shift_harakat_position: bool

Whether to shift the Harakat (Tashkeel) one position so they appear correctly when string is reversed

§delete_tatweel: bool

Whether to delete the Tatweel (U+0640) before reshaping or not.

§support_zwj: bool

Whether to support ZWJ (U+200D) or not.

§use_unshaped_instead_of_isolated: bool

Use unshaped form instead of isolated form.

§support_ligatures: bool

Whether to use ligatures or not. Serves as a shortcut to disable all ligatures.

§ligatures: Ligatures

When support_ligatures is enabled. Separate ligatures configuration take precedence over it. When support_ligatures is disabled, separate ligatures configurations are ignored.

Implementations§

Source§

impl ReshaperConfig

Source

pub const fn new(language: Language, ligatures_flags: LigaturesFlags) -> Self

Create a new ReshaperConfig with the given LigaturesFlags.

Examples found in repository?
examples/custom_config.rs (line 4)
3fn main() {
4    let reshaper = ReshaperConfig::new(Language::ArabicV2, LigaturesFlags::none()).to_reshaper();
5
6    println!("{}", reshaper.reshape("سهل"));
7}
Source

pub fn to_reshaper(self) -> ArabicReshaper

Create a new ArabicReshaper from the config.

Examples found in repository?
examples/custom_config.rs (line 4)
3fn main() {
4    let reshaper = ReshaperConfig::new(Language::ArabicV2, LigaturesFlags::none()).to_reshaper();
5
6    println!("{}", reshaper.reshape("سهل"));
7}
Source

pub fn update_ligature(&mut self, name: LigatureNames, enable: bool)

Update the given LigatureNames.

Trait Implementations§

Source§

impl Clone for ReshaperConfig

Source§

fn clone(&self) -> ReshaperConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ReshaperConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<ReshaperConfig> for ArabicReshaper

Source§

fn from(value: ReshaperConfig) -> Self

Converts to this type from the input type.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.