ratatui::text

Trait ToText

source
pub trait ToText {
    // Required method
    fn to_text(&self) -> Text<'_>;
}
Expand description

A trait for converting a value to a Text.

This trait is automatically implemented for any type that implements the Display trait. As such, ToText shouldn’t be implemented directly: Display should be implemented instead, and you get the ToText implementation for free.

Required Methods§

source

fn to_text(&self) -> Text<'_>

Converts the value to a Text.

Implementors§

source§

impl<T: Display> ToText for T

§Panics

In this implementation, the to_text method panics if the Display implementation returns an error. This indicates an incorrect Display implementation since fmt::Write for String never returns an error itself.