ratatui::text

Trait ToSpan

Source
pub trait ToSpan {
    // Required method
    fn to_span(&self) -> Span<'_>;
}
Expand description

A trait for converting a value to a Span.

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

Required Methods§

Source

fn to_span(&self) -> Span<'_>

Converts the value to a Span.

Implementors§

Source§

impl<T: Display> ToSpan for T

§Panics

In this implementation, the to_span 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.