Trait ratatui::style::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>).

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Styled for String

§

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

§

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

§

type Item = Style

source§

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

§

type Item = Line<'a>

source§

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

§

type Item = Span<'a>

source§

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

source§

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

§

type Item = Text<'a>

source§

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

§

type Item = Block<'a>

source§

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

§

type Item = Axis<'a>

source§

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

§

type Item = BarChart<'a>

source§

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

§

type Item = Cell<'a>

source§

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

§

type Item = Chart<'a>

source§

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

§

type Item = Dataset<'a>

source§

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

§

type Item = Gauge<'a>

source§

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

§

type Item = LineGauge<'a>

source§

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

§

type Item = List<'a>

source§

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

§

type Item = ListItem<'a>

source§

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

§

type Item = Paragraph<'a>

source§

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

§

type Item = Row<'a>

source§

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

§

type Item = Sparkline<'a>

source§

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

§

type Item = Table<'a>

source§

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

§

type Item = Tabs<'a>