Trait stylish_stringlike::text::HasWidth[][src]

pub trait HasWidth {
    fn width(&self) -> Width;
}
Expand description

Support for returning the unicode width of a text object

Required methods

fn width(&self) -> Width[src]

Return the unicode width of an object

Example

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));

Implementations on Foreign Types

impl<T> HasWidth for Option<T> where
    T: HasWidth
[src]

fn width(&self) -> Width[src]

impl HasWidth for String[src]

fn width(&self) -> Width[src]

impl HasWidth for &str[src]

fn width(&self) -> Width[src]

Implementors

impl<'a, T> HasWidth for Repeat<'a, T>[src]

fn width(&self) -> Width[src]

impl<'a, T: Clone> HasWidth for Span<'a, T>[src]

fn width(&self) -> Width[src]

impl<'a, T: Clone, U: Clone> HasWidth for TextWidget<'a, T, U> where
    T: HasWidth
[src]

fn width(&self) -> Width[src]

impl<T> HasWidth for Spans<T>[src]

fn width(&self) -> Width[src]