ratatui::style

Trait Styled

source
pub trait Styled {
    type Item;

    // Required methods
    fn style(&self) -> Style;
    fn set_style<S: Into<Style>>(self, style: S) -> Self::Item;
}
Expand description

A trait for objects that have a Style.

This trait enables generic code to be written that can interact with any object that has a Style. This is used by the Stylize trait to allow generic code to be written that can interact with any object that can be styled.

Required Associated Types§

Required Methods§

source

fn style(&self) -> Style

Returns the style of the object.

source

fn set_style<S: Into<Style>>(self, style: S) -> Self::Item

Sets the style of the object.

style accepts any type that is convertible to Style (e.g. Style, Color, or your own type that implements Into<Style>).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl Styled for String

source§

type Item = Span<'static>

source§

fn style(&self) -> Style

source§

fn set_style<S: Into<Style>>(self, style: S) -> Self::Item

source§

impl<'a> Styled for &'a str

source§

type Item = Span<'a>

source§

fn style(&self) -> Style

source§

fn set_style<S: Into<Style>>(self, style: S) -> Self::Item

Implementors§

source§

impl Styled for Style

source§

impl<'a> Styled for Line<'a>

source§

type Item = Line<'a>

source§

impl<'a> Styled for Span<'a>

source§

type Item = Span<'a>

source§

impl<'a> Styled for StyledGrapheme<'a>

source§

impl<'a> Styled for Text<'a>

source§

type Item = Text<'a>

source§

impl<'a> Styled for Block<'a>

source§

type Item = Block<'a>

source§

impl<'a> Styled for Axis<'a>

source§

type Item = Axis<'a>

source§

impl<'a> Styled for BarChart<'a>

source§

impl<'a> Styled for Cell<'a>

source§

type Item = Cell<'a>

source§

impl<'a> Styled for Chart<'a>

source§

type Item = Chart<'a>

source§

impl<'a> Styled for Dataset<'a>

source§

impl<'a> Styled for Gauge<'a>

source§

type Item = Gauge<'a>

source§

impl<'a> Styled for LineGauge<'a>

source§

impl<'a> Styled for List<'a>

source§

type Item = List<'a>

source§

impl<'a> Styled for ListItem<'a>

source§

impl<'a> Styled for Paragraph<'a>

source§

impl<'a> Styled for Row<'a>

source§

type Item = Row<'a>

source§

impl<'a> Styled for Sparkline<'a>

source§

impl<'a> Styled for Table<'a>

source§

type Item = Table<'a>

source§

impl<'a> Styled for Tabs<'a>

source§

type Item = Tabs<'a>