pub enum AmbiguousWidthTreatment {
Narrow,
Wide,
}Expand description
How to treat ambiguous width characters
Some Unicode characters have ambiguous width properties, meaning their display width depends on the context (terminal, font, locale, etc.). This enum allows you to specify how such characters should be treated.
§Examples
use string_width::{AmbiguousWidthTreatment, StringWidthOptions, string_width_with_options};
let text = "±×÷"; // Ambiguous width characters
let narrow_options = StringWidthOptions {
count_ansi: false,
ambiguous_width: AmbiguousWidthTreatment::Narrow,
};
assert_eq!(string_width_with_options(text, narrow_options), 3);
let wide_options = StringWidthOptions {
count_ansi: false,
ambiguous_width: AmbiguousWidthTreatment::Wide,
};
assert_eq!(string_width_with_options(text, wide_options), 6);Variants§
Narrow
Treat ambiguous characters as narrow (width 1)
Wide
Treat ambiguous characters as wide (width 2)
Trait Implementations§
Source§impl Clone for AmbiguousWidthTreatment
impl Clone for AmbiguousWidthTreatment
Source§fn clone(&self) -> AmbiguousWidthTreatment
fn clone(&self) -> AmbiguousWidthTreatment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AmbiguousWidthTreatment
impl Debug for AmbiguousWidthTreatment
Source§impl Default for AmbiguousWidthTreatment
impl Default for AmbiguousWidthTreatment
Source§impl PartialEq for AmbiguousWidthTreatment
impl PartialEq for AmbiguousWidthTreatment
impl Copy for AmbiguousWidthTreatment
impl Eq for AmbiguousWidthTreatment
impl StructuralPartialEq for AmbiguousWidthTreatment
Auto Trait Implementations§
impl Freeze for AmbiguousWidthTreatment
impl RefUnwindSafe for AmbiguousWidthTreatment
impl Send for AmbiguousWidthTreatment
impl Sync for AmbiguousWidthTreatment
impl Unpin for AmbiguousWidthTreatment
impl UnwindSafe for AmbiguousWidthTreatment
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