Text

Struct Text 

Source
pub struct Text<'s> { /* private fields */ }
Expand description

An element that renders a piece of text.

Implementations§

Source§

impl<'s> Text<'s>

Source

pub fn new(value: &'s str) -> Self

Creates a new Text from the given string.

Trait Implementations§

Source§

impl<'s> Element<'s> for Text<'s>

Source§

fn width(&self) -> usize

The width of the element, in columns.
Source§

fn render(&self) -> impl DoubleEndedIterator<Item = RenderChunk<'s>>

Renders the element into a sequence of chunks.
Source§

impl<'s> From<&'s str> for Text<'s>

Source§

fn from(value: &'s str) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'s> Freeze for Text<'s>

§

impl<'s> RefUnwindSafe for Text<'s>

§

impl<'s> Send for Text<'s>

§

impl<'s> Sync for Text<'s>

§

impl<'s> Unpin for Text<'s>

§

impl<'s> UnwindSafe for Text<'s>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'s, E> IntoElement<'s> for E
where E: Element<'s>,

Source§

type ElementType = E

The element type to be converted into.
Source§

fn into_element(self) -> <E as IntoElement<'s>>::ElementType

Converts this type into an Element.
Source§

fn fixed_width(self, width: usize) -> FixedWidth<Self::ElementType>

Convenience function to wrap this element in a FixedWidth.
Source§

fn styled(self, style: Style) -> Styled<Self::ElementType>

Convenience function to wrap this element in a Styled.
Source§

fn boxed(self) -> BoxElement<'s>

Convenience function to box this element.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.