[][src]Trait coffee::ui::core::Renderer

pub trait Renderer {
    type Configuration: Default;
    fn load(config: Self::Configuration) -> Task<Self>
        Self: Sized
fn explain(&mut self, layout: &Layout, color: Color);
fn flush(&mut self, frame: &mut Frame); }

The renderer of a user interface.

The implementor of this trait will also need to implement the Renderer trait of the widgets you want to use.

Associated Types

type Configuration: Default

The configuration of the renderer.

It has to implement the Default trait.

This type allows you to provide a way for your users to customize the renderer. For example, you could make the default text color and size of your configurable, support different fonts, etc.

Loading content...

Required methods

fn load(config: Self::Configuration) -> Task<Self> where
    Self: Sized

Loads the renderer with the given configuration.

fn explain(&mut self, layout: &Layout, color: Color)

Explains the Layout of an Element for debugging purposes.

This will be called when Element::explain has been used. It should explain the Layout graphically.

fn flush(&mut self, frame: &mut Frame)

Flushes the renderer to draw on the given Frame.

This method will be called by the runtime after calling Widget::draw for all the widgets of the user interface.

The recommended strategy to implement a Renderer is to use Batch and call Batch::draw here.

Loading content...


impl Renderer for Renderer[src]

type Configuration = Configuration

Loading content...