Skip to main content

Backend

Trait Backend 

Source
pub trait Backend {
    // Required methods
    fn present(&mut self, grid: &Grid, out: &mut dyn Write) -> Result<()>;
    fn invalidate(&mut self);

    // Provided methods
    fn scroll(
        &mut self,
        _from: &Grid,
        _to: &Grid,
        _area: Rect,
        _rows: i32,
        _out: &mut dyn Write,
    ) -> Result<()> { ... }
    fn gliding(&self) -> Option<Duration> { ... }
    fn glide(&mut self, _now: Instant, _out: &mut dyn Write) -> Result<()> { ... }
    fn settle(&mut self) { ... }
}
Expand description

Presents a grid. Implementations send only what changed since the last call.

Required Methods§

Source

fn present(&mut self, grid: &Grid, out: &mut dyn Write) -> Result<()>

Source

fn invalidate(&mut self)

Forgets what the terminal shows, so the next present redraws everything.

Provided Methods§

Source

fn scroll( &mut self, _from: &Grid, _to: &Grid, _area: Rect, _rows: i32, _out: &mut dyn Write, ) -> Result<()>

Starts moving area from one grid to the other, rows lines further down the content, or up if negative, and carries on from where it is if it’s already moving. The moving happens in glide. Tiers that can’t move anything by less than a cell do nothing, and the page just jumps.

Source

fn gliding(&self) -> Option<Duration>

How often a scroll under way wants to move, if there is one.

Source

fn glide(&mut self, _now: Instant, _out: &mut dyn Write) -> Result<()>

Moves a scroll under way one step on.

Source

fn settle(&mut self)

Ends a scroll under way, for the next present to show the page as it is.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§