DisplayBackend

Trait DisplayBackend 

Source
pub trait DisplayBackend: Write {
    // Required methods
    fn set_attributes(&mut self, attributes: Attributes) -> Result<()>;
    fn set_fg(&mut self, color: Color) -> Result<()>;
    fn set_bg(&mut self, color: Color) -> Result<()>;

    // Provided method
    fn write_styled(&mut self, styled: &Styled<dyn Display + '_>) -> Result<()> { ... }
}
Expand description

A trait to represent a terminal that can be rendered to without interaction.

Required Methods§

Source

fn set_attributes(&mut self, attributes: Attributes) -> Result<()>

Sets the given attributes removing ones which were previous applied.

Source

fn set_fg(&mut self, color: Color) -> Result<()>

Sets the foreground color.

Source

fn set_bg(&mut self, color: Color) -> Result<()>

Sets the background color.

Provided Methods§

Source

fn write_styled(&mut self, styled: &Styled<dyn Display + '_>) -> Result<()>

Write a styled object to the backend.

See also Styled and Stylize.

Implementations on Foreign Types§

Source§

impl<B: DisplayBackend> DisplayBackend for &mut B

Source§

fn set_attributes(&mut self, attributes: Attributes) -> Result<()>

Source§

fn set_fg(&mut self, color: Color) -> Result<()>

Source§

fn set_bg(&mut self, color: Color) -> Result<()>

Source§

fn write_styled(&mut self, styled: &Styled<dyn Display + '_>) -> Result<()>

Implementors§