Trait makeup::render::Renderer

source ·
pub trait Renderer: Debug + AsAny + Send + Sync {
    // Required methods
    fn render<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        commands: &'life1 [DrawCommandBatch]
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn move_cursor<'life0, 'async_trait>(
        &'life0 mut self,
        x: Coordinate,
        y: Coordinate
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn move_cursor_relative<'life0, 'async_trait>(
        &'life0 mut self,
        x: RelativeCoordinate,
        y: RelativeCoordinate
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_at_cursor<'life0, 'async_trait>(
        &'life0 self,
        width: Dimension
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_string<'life0, 'async_trait>(
        &'life0 self,
        x: Coordinate,
        y: Coordinate,
        width: Dimension
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn cursor(&self) -> Coordinates;
    fn dimensions(&self) -> Dimensions;
    fn set_width(&mut self, w: Dimension);
    fn set_height(&mut self, h: Dimension);
}
Expand description

A Renderer takes in a slice of DrawCommandBatches and renders them somehow. No constraints are placed on rendering, ie a renderer can use any backend it sees fit. Built-in renderers include MemoryRenderer and TerminalRenderer.

Renderers that might be useful to implement on your own are things like:

  • A renderer that can render to a canvas backend, for trivial WASM parity

Required Methods§

source

fn render<'life0, 'life1, 'async_trait>( &'life0 mut self, commands: &'life1 [DrawCommandBatch] ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn flush<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn move_cursor<'life0, 'async_trait>( &'life0 mut self, x: Coordinate, y: Coordinate ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn move_cursor_relative<'life0, 'async_trait>( &'life0 mut self, x: RelativeCoordinate, y: RelativeCoordinate ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn read_at_cursor<'life0, 'async_trait>( &'life0 self, width: Dimension ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn read_string<'life0, 'async_trait>( &'life0 self, x: Coordinate, y: Coordinate, width: Dimension ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn cursor(&self) -> Coordinates

source

fn dimensions(&self) -> Dimensions

source

fn set_width(&mut self, w: Dimension)

source

fn set_height(&mut self, h: Dimension)

Implementors§