Trait Engine

Source
pub trait Engine {
    type Buffer: CommandBuffer + Clear;

    // Required methods
    fn get_command_buffer(&self) -> Self::Buffer;
    fn render(&mut self, render_commands: &Self::Buffer) -> Result<()>;
    fn finish_rendering(&mut self) -> Result<()>;
    fn read_key(&self) -> Result<Key>;
}
Expand description

Represents the backend to draw prompts on the screen and handle input

Required Associated Types§

Source

type Buffer: CommandBuffer + Clear

Type of the corresponding command buffer

Required Methods§

Source

fn get_command_buffer(&self) -> Self::Buffer

Creates a new instanse of the CommandBuffer implementation

Source

fn render(&mut self, render_commands: &Self::Buffer) -> Result<()>

Renders content to the terminal using the specified rendering commands

Source

fn finish_rendering(&mut self) -> Result<()>

This is called when a prompt is submitted and needs to be rendered in its final state.

Source

fn read_key(&self) -> Result<Key>

Reads a key that was pressed. This is a blocking call

Implementors§

Source§

impl<W: Write> Engine for CrosstermEngine<W>

Source§

type Buffer = CrosstermCommandBuffer<W>