pub struct Toast { /* private fields */ }Expand description
One notification: what happened, how bad it is, and at most one thing to do about it.
Implementations§
Source§impl Toast
impl Toast
pub fn new(ident: impl Into<Ident>, message: impl Into<SharedString>) -> Self
pub fn tone(self, tone: Tone) -> Self
Sourcepub fn detail(self, detail: impl Into<SharedString>) -> Self
pub fn detail(self, detail: impl Into<SharedString>) -> Self
A second line, for the part of the report that does not fit in one.
Sourcepub fn action(
self,
label: impl Into<SharedString>,
handler: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn action( self, label: impl Into<SharedString>, handler: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
The one thing that can be done about this. A later call replaces an earlier one, because a notification with two answers is a dialog.
Sourcepub fn dismissable(self, dismissable: bool) -> Self
pub fn dismissable(self, dismissable: bool) -> Self
Whether the toast carries a dismiss control. A toast that cannot be dismissed renders no such control and installs no handler for it.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Leaves on its own after timeout, whatever the tone says.
Sourcepub fn persistent(self) -> Self
pub fn persistent(self) -> Self
Stays until it is dismissed.
pub fn ident(&self) -> &Ident
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Toast
impl !Send for Toast
impl !Sync for Toast
impl !UnwindSafe for Toast
impl Freeze for Toast
impl Unpin for Toast
impl UnsafeUnpin for Toast
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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