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§
fn render(&mut self, frame: &mut Frame<'_>)
Sourcefn handle_key(&mut self, key: KeyEvent)
fn handle_key(&mut self, key: KeyEvent)
A key press (Ctrl-C goes to Screen::interrupt instead).
fn interrupt(&mut self)
fn done(&self) -> bool
Provided Methods§
Sourcefn pending_work(&self) -> Option<String>
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.
fn do_work(&mut self)
Sourcefn tick(&mut self) -> bool
fn tick(&mut self) -> bool
Called about every TICK, keys or not: true redraws, for a view
waiting on work in the background.
Sourcefn takes_mouse(&self) -> bool
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.
Sourcefn mouse(&mut self, _event: MouseEvent) -> bool
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.
Sourcefn reports_chords(&self) -> bool
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.
Sourcefn take_notice(&mut self) -> Option<String>
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".