Skip to main content

MicroRenderer

Trait MicroRenderer 

Source
pub trait MicroRenderer: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn render(
        &self,
        placement: &Placement<'_>,
        console: &Console,
    ) -> Option<Vec<Segment>>;
}
Expand description

Draws a placement. Implementations must return segments whose visible width (control segments count zero) is exactly placement.meta.cols, or None to pass. Anything else is ignored and the fallback stays.

A two-row asset is offered one row at a time, top first (placement.meta.row is 0, then 1), and drawn only when the same renderer draws both: an image drawn at the cursor goes with the last row, moving the cursor up to the first. The rows are printed on consecutive lines at the same column.

Return only what the target can show: a renderer is picked per console, and the console’s capabilities are the renderer’s to check. Keep the tag on visible cells (Placement::style) so later passes can still find the asset.

Required Methods§

Source

fn name(&self) -> &str

A short name, for diagnostics (fallback, kitty, …).

Source

fn render( &self, placement: &Placement<'_>, console: &Console, ) -> Option<Vec<Segment>>

Draw placement, or pass.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: MicroRenderer + ?Sized> MicroRenderer for Arc<T>

Source§

fn name(&self) -> &str

Source§

fn render( &self, placement: &Placement<'_>, console: &Console, ) -> Option<Vec<Segment>>

Implementors§