Skip to main content

Screen

Trait Screen 

Source
pub trait Screen {
    // Required methods
    fn render(&mut self, frame: &mut Frame<'_>);
    fn handle_key(&mut self, key: KeyEvent);
    fn interrupt(&mut self);
    fn done(&self) -> bool;

    // Provided methods
    fn pending_work(&self) -> Option<String> { ... }
    fn do_work(&mut self) { ... }
    fn tick(&mut self) -> bool { ... }
    fn takes_mouse(&self) -> bool { ... }
    fn mouse(&mut self, _event: MouseEvent) -> bool { ... }
    fn reports_chords(&self) -> bool { ... }
    fn take_notice(&mut self) -> Option<String> { ... }
}
Expand description

A full-screen view driven by run_screen.

Required Methods§

Source

fn render(&mut self, frame: &mut Frame<'_>)

Source

fn handle_key(&mut self, key: KeyEvent)

A key press (Ctrl-C goes to Screen::interrupt instead).

Source

fn interrupt(&mut self)

Source

fn done(&self) -> bool

Provided Methods§

Source

fn pending_work(&self) -> Option<String>

Blocking work the last key asked for, as a line to print while it runs; Screen::do_work then does it.

Source

fn do_work(&mut self)

Source

fn tick(&mut self) -> bool

Called about every TICK, keys or not: true redraws, for a view waiting on work in the background.

Source

fn takes_mouse(&self) -> bool

Whether the view takes the mouse: only then is the terminal asked for it, since a view holding it keeps text from being selected.

Source

fn mouse(&mut self, _event: MouseEvent) -> bool

A mouse event (a button pressed or let go, or a turn of the wheel) at a cell of the screen; whether the screen changed and is drawn again.

Source

fn reports_chords(&self) -> bool

Whether the terminal is asked to report keys held with Shift, Alt or Ctrl apart (the kitty keyboard protocol; others ignore the request), so that Shift+Enter, say, is not taken for Enter.

Source

fn take_notice(&mut self) -> Option<String>

Something to tell whoever is away, once: run_screen rings the terminal’s bell and asks it for a desktop notification saying it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§