pub struct ToastHandle { /* private fields */ }Expand description
Returned by Toast::present (and ctx.show_toast(toast)). Cheap
to clone (Rc<Inner>). Lets app code dismiss the toast
programmatically or check whether it is still alive.
Dropping the handle does NOT dismiss the toast — toasts have their own lifecycle managed by the host (timer + manual paths). The handle is the OPTIONAL “I want to control this toast later” hook.
Implementations§
Source§impl ToastHandle
impl ToastHandle
Sourcepub fn entry_id(&self) -> u64
pub fn entry_id(&self) -> u64
Stable per-toast id. Two ToastHandles pointing at the same
underlying toast share the same entry_id. The id is unique
per ToastRegistry (per app) — it doesn’t survive across app
restarts.
Sourcepub fn is_alive(&self) -> bool
pub fn is_alive(&self) -> bool
Whether the toast is still in the registry’s live set (timer
hasn’t expired, user hasn’t dismissed, host hasn’t shut down).
Always false for overflow-dropped toasts.
Sourcepub fn dismiss(&self, ctx: &mut EventContext<'_>)
pub fn dismiss(&self, ctx: &mut EventContext<'_>)
Programmatically dismiss the toast with cause
ToastDismissCause::Programmatic. No-op if the toast is
already dismissed (timer, user, host shutdown).
Trait Implementations§
Source§impl Clone for ToastHandle
impl Clone for ToastHandle
Source§fn clone(&self) -> ToastHandle
fn clone(&self) -> ToastHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ToastHandle
impl !Send for ToastHandle
impl !Sync for ToastHandle
impl !UnwindSafe for ToastHandle
impl Freeze for ToastHandle
impl Unpin for ToastHandle
impl UnsafeUnpin for ToastHandle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more