pub struct Tui<'s> { /* private fields */ }Expand description
The terminal a command’s views draw on, in the command’s session: up
from the first view (Tui::run) until dropped, so every view of the
command and the work between them (Tui::work) share one screen.
While it is up, a data-beans kill asks the views to stop as Ctrl-C
does (Tui::stop_requested), and work under way finishes first. Log
records raised while it is up are held back and written once the
normal screen is back, or as work between views runs.
Implementations§
Source§impl<'s> Tui<'s>
impl<'s> Tui<'s>
pub fn session(&self) -> &'s Session
Sourcepub fn stop_requested(&self) -> bool
pub fn stop_requested(&self) -> bool
Whether data-beans kill asked the command to stop: no more views
and no more work after the one running.
Sourcepub fn run<S: Screen>(&mut self, screen: &mut S) -> Result<()>
pub fn run<S: Screen>(&mut self, screen: &mut S) -> Result<()>
Run screen until it is done, its keys to Screen::handle_key.
Sourcepub fn run_with<S: Screen>(
&mut self,
screen: &mut S,
on_key: impl FnMut(&mut S, KeyEvent),
) -> Result<()>
pub fn run_with<S: Screen>( &mut self, screen: &mut S, on_key: impl FnMut(&mut S, KeyEvent), ) -> Result<()>
Run screen until it is done, each key (but Ctrl-C) handed to
on_key. The screen comes up with the first view and stays up
after. A stop interrupts the view, as Ctrl-C does. Blocking work
(Screen::pending_work) runs on the normal screen, where its own
progress output belongs, and the view comes back after it. The
mouse and keys held with modifiers are reported only to a screen
that asks for them, and events already queued (a turn of the wheel
is several) are taken before the screen is drawn again. After an
attach the modes are on again and the view is drawn whole.
Sourcepub fn work<T>(&mut self, f: impl FnOnce() -> T) -> Result<T>
pub fn work<T>(&mut self, f: impl FnOnce() -> T) -> Result<T>
Run f, the command’s own work before, between or after its
views, on the normal screen, its log records written as they come;
the screen is taken back after it, to be drawn whole by the next
view. A kill meanwhile lets f finish and is then
Tui::stop_requested. Before the first view the screen stays
down: f runs where it is, a kill waiting for it all the same.
Trait Implementations§
Auto Trait Implementations§
impl<'s> Freeze for Tui<'s>
impl<'s> RefUnwindSafe for Tui<'s>
impl<'s> Send for Tui<'s>
impl<'s> Sync for Tui<'s>
impl<'s> Unpin for Tui<'s>
impl<'s> UnsafeUnpin for Tui<'s>
impl<'s> UnwindSafe for Tui<'s>
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.