pub struct ModalStack { /* private fields */ }Expand description
Stack of Dialogs. The topmost dialog receives keys first;
DialogOutcome::Close pops it.
The Send bound on the contained trait objects keeps
ModalStack usable inside an async task that may be moved
between tokio worker threads.
Implementations§
Source§impl ModalStack
impl ModalStack
Sourcepub fn push(&mut self, dialog: Box<dyn Dialog + Send>)
pub fn push(&mut self, dialog: Box<dyn Dialog + Send>)
Push a dialog onto the stack. It becomes the new top.
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> DialogOutcome
pub fn handle_key(&mut self, key: KeyEvent) -> DialogOutcome
Route a key event to the topmost dialog. Empty stack returns
DialogOutcome::Consumed (nothing to do).
Automatically handles two stack-management outcomes:
DialogOutcome::Closepops the top dialog.DialogOutcome::Pushpushes the returned dialog onto the stack and reportsDialogOutcome::Consumedto the caller (the push is an internal transition).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModalStack
impl !RefUnwindSafe for ModalStack
impl Send for ModalStack
impl !Sync for ModalStack
impl Unpin for ModalStack
impl UnsafeUnpin for ModalStack
impl !UnwindSafe for ModalStack
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more