Struct ar_reshaper::ArabicReshaper
source · pub struct ArabicReshaper { /* private fields */ }Expand description
ArabicReshaper
the main type for reconstructing sentences to be used in applications that don’t support Arabic script.
Implementations§
source§impl ArabicReshaper
impl ArabicReshaper
sourcepub fn new(config: ReshaperConfig) -> Self
pub fn new(config: ReshaperConfig) -> Self
Create a new ArabicReshaper using the given config
sourcepub fn reshape<S>(&self, text: S) -> Stringwhere
S: AsRef<str>,
pub fn reshape<S>(&self, text: S) -> Stringwhere S: AsRef<str>,
Reshape the given line and return the reshaped string
sourcepub fn reshape_lines<S, L>(&self, lines: L) -> Vec<String>where
S: AsRef<str>,
L: AsRef<[S]>,
pub fn reshape_lines<S, L>(&self, lines: L) -> Vec<String>where S: AsRef<str>, L: AsRef<[S]>,
Reshape all lines in the given slice and return a new Vec
Examples found in repository?
examples/reshape_lines.rs (line 11)
3 4 5 6 7 8 9 10 11 12 13 14
fn main() {
let reshaper = ArabicReshaper::default();
let lines = [
"به نام خدا",
"همه چی درست میشه!"
];
for line in reshaper.reshape_lines(lines) {
println!("{line}");
}
}sourcepub fn modify_config<F>(&mut self, func: F)where
F: FnOnce(&mut ReshaperConfig),
pub fn modify_config<F>(&mut self, func: F)where F: FnOnce(&mut ReshaperConfig),
A safe way to modify the config (ReshaperConfig) after creating the ArabicReshaper.
Trait Implementations§
source§impl Default for ArabicReshaper
impl Default for ArabicReshaper
source§fn default() -> ArabicReshaper
fn default() -> ArabicReshaper
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for ArabicReshaper
impl Send for ArabicReshaper
impl Sync for ArabicReshaper
impl Unpin for ArabicReshaper
impl UnwindSafe for ArabicReshaper
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