Trait HasWidth
stylish_stringlike::text
pub trait HasWidth { fn width(&self) -> Width; }
Support for returning the unicode width of a text object
fn width(&self) -> Width
Return the unicode width of an object
use stylish_stringlike::text::{HasWidth, Width}; let foo = "foobar"; assert_eq!(foo.width(), Width::Bounded(6)); let bar = String::from("🙈🙉🙊"); assert_eq!(bar.width(), Width::Bounded(6));
impl<T> HasWidth for Option<T> where T: HasWidth,
impl HasWidth for String
impl HasWidth for &str
impl<'a, T> HasWidth for Repeat<'a, T>
impl<'a, T: Clone> HasWidth for Span<'a, T>
impl<'a, T: Clone, U: Clone> HasWidth for TextWidget<'a, T, U> where T: HasWidth,
impl<T> HasWidth for Spans<T>