pub trait EventContextToastExt {
// Required methods
fn show_toast(&mut self, toast: Toast) -> ToastHandle;
fn dismiss_toast(&mut self, handle: &ToastHandle);
}Expand description
Convenience methods on [EventContext] for the toast system. The
registry is looked up via [EventContext::app_state] — the
install_toast extension trait registers ToastRegistry there
at app boot.
All methods are no-ops (returning a dropped ToastHandle where
applicable) when install_toast was not called — a one-shot
log::warn! fires the first time the missing registration is
detected, so missing installs surface in logs without crashing
app code that defensively calls show_toast.
Required Methods§
Sourcefn show_toast(&mut self, toast: Toast) -> ToastHandle
fn show_toast(&mut self, toast: Toast) -> ToastHandle
Present a Toast through the installed
ToastHost. Returns a
ToastHandle for programmatic control.
Sourcefn dismiss_toast(&mut self, handle: &ToastHandle)
fn dismiss_toast(&mut self, handle: &ToastHandle)
Programmatically dismiss a toast by handle, with cause
ToastDismissCause::Programmatic. Equivalent to
handle.dismiss(ctx). No-op if the toast has already been
dismissed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".