pub trait Screen {
Show 13 methods
// 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 quit(&mut self) { ... }
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> { ... }
fn status(&self) -> Option<String> { ... }
}Expand description
A full-screen view, driven by Tui::run or run_screen.
Required Methods§
Sourcefn handle_key(&mut self, key: KeyEvent)
fn handle_key(&mut self, key: KeyEvent)
A key press (Ctrl-C goes to Screen::interrupt instead).
Provided Methods§
Sourcefn quit(&mut self)
fn quit(&mut self)
A kill asked the view to stop: leave as its quit key does,
without asking; work that must finish may run on, and is waited
for (Tui::settle). By default as Ctrl-C.
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.
Sourcefn do_work(&mut self)
fn do_work(&mut self)
Do the work Screen::pending_work named.
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, asked only of a terminal
that says it has it: Keyboard::DISAMBIGUATE), 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: the loop rings the
terminal’s bell and asks it for a desktop notification saying it
(notify).
Sourcefn status(&self) -> Option<String>
fn status(&self) -> Option<String>
What the view is doing, in one short line, for the tool’s session
list and the session picker to show (Session::status).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".