BoundedWidth

Trait BoundedWidth 

Source
pub trait BoundedWidth {
    // Required method
    fn bounded_width(&self) -> usize;
}
Expand description

Support for returing the unicode width of text objects that are finite

Required Methods§

Source

fn bounded_width(&self) -> usize

Return the finite unicode width of an object

§Example
use stylish_stringlike::text::BoundedWidth;
let foo = "foobar";
assert_eq!(foo.bounded_width(), 6);
let bar = String::from("🙈🙉🙊");
assert_eq!(bar.bounded_width(), 6);

Implementations on Foreign Types§

Source§

impl BoundedWidth for &str

Source§

impl BoundedWidth for String

Source§

impl<T> BoundedWidth for Option<T>
where T: BoundedWidth,

Implementors§

Source§

impl<'a, T: Clone> BoundedWidth for Span<'a, T>

Source§

impl<T> BoundedWidth for Spans<T>