Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer: Send + Sync {
    // Required methods
    fn start(&mut self);
    fn close(&mut self) -> Result<(), Box<dyn Error>>;
    fn render(&mut self, view: View);
    fn flush(&mut self, closing: bool) -> Result<(), Box<dyn Error>>;
    fn reset(&mut self);
    fn insert_above(&mut self, s: String) -> Result<(), Box<dyn Error>>;
    fn resize(&mut self, width: usize, height: usize);
    fn clear_screen(&mut self);
    fn write_string(&mut self, s: &str) -> Result<usize, Box<dyn Error>>;
    fn on_mouse(&mut self, msg: MouseMsg) -> Cmd;
    fn set_optimizations(
        &mut self,
        hard_tabs: bool,
        backspace: bool,
        map_nl: bool,
    );
    fn set_color_profile(&mut self, p: Profile);
}
Expand description

Renderer interface for Bubble Tea v2.0.8.

Required Methods§

Source

fn start(&mut self)

Starts the renderer.

Source

fn close(&mut self) -> Result<(), Box<dyn Error>>

Closes the renderer and flushes any remaining data.

Source

fn render(&mut self, view: View)

Renders a declarative View frame.

Source

fn flush(&mut self, closing: bool) -> Result<(), Box<dyn Error>>

Flushes renderer output buffer to terminal stdout.

Source

fn reset(&mut self)

Resets renderer to initial state.

Source

fn insert_above(&mut self, s: String) -> Result<(), Box<dyn Error>>

Inserts unmanaged lines above the TUI renderer.

Source

fn resize(&mut self, width: usize, height: usize)

Resize notification.

Source

fn clear_screen(&mut self)

Clears terminal screen.

Source

fn write_string(&mut self, s: &str) -> Result<usize, Box<dyn Error>>

Write raw string to output.

Source

fn on_mouse(&mut self, msg: MouseMsg) -> Cmd

Mouse event interceptor.

Source

fn set_optimizations(&mut self, hard_tabs: bool, backspace: bool, map_nl: bool)

Sets the cursor movement optimizations (hard tabs, backspace, newline mapping).

Source

fn set_color_profile(&mut self, p: Profile)

Sets the terminal color profile used for downsampling colors.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§