pub struct Snackbar { /* private fields */ }Expand description
A message for a window’s snackbar queue. The default timeout is four seconds.
Implementations§
Source§impl Snackbar
impl Snackbar
pub fn new(message: impl Into<SharedString>) -> Snackbar
Sourcepub fn timeout(self, timeout: Option<Duration>) -> Snackbar
pub fn timeout(self, timeout: Option<Duration>) -> Snackbar
Sets how long the message is visible. None waits for explicit dismissal.
Sourcepub fn action(
self,
label: impl Into<SharedString>,
action: impl Fn(&mut Window, &mut App) + 'static,
) -> Snackbar
pub fn action( self, label: impl Into<SharedString>, action: impl Fn(&mut Window, &mut App) + 'static, ) -> Snackbar
Adds a keyboard-accessible action. By default, messages with an action
persist. Call timeout after this method to set a duration explicitly.
Sourcepub fn message(&self) -> &SharedString
pub fn message(&self) -> &SharedString
Returns the plain message used as the status announcement.
Sourcepub fn action_label(&self) -> Option<&SharedString>
pub fn action_label(&self) -> Option<&SharedString>
Returns the accessible name of the optional action.
Sourcepub fn message_content<E>(
self,
content: impl Fn(&mut Window, &mut App) -> E + 'static,
) -> Snackbarwhere
E: IntoElement,
pub fn message_content<E>(
self,
content: impl Fn(&mut Window, &mut App) -> E + 'static,
) -> Snackbarwhere
E: IntoElement,
Replaces the visible message with repeatable decorative content.
Sourcepub fn action_content<E>(
self,
content: impl Fn(&mut Window, &mut App) -> E + 'static,
) -> Snackbarwhere
E: IntoElement,
pub fn action_content<E>(
self,
content: impl Fn(&mut Window, &mut App) -> E + 'static,
) -> Snackbarwhere
E: IntoElement,
Replaces the visible content of the named action supplied by Self::action.
Sourcepub fn dismiss_content<E>(
self,
label: impl Into<SharedString>,
content: impl Fn(&mut Window, &mut App) -> E + 'static,
) -> Snackbarwhere
E: IntoElement,
pub fn dismiss_content<E>(
self,
label: impl Into<SharedString>,
content: impl Fn(&mut Window, &mut App) -> E + 'static,
) -> Snackbarwhere
E: IntoElement,
Supplies the accessible name and decorative content of the close affordance.
Sourcepub fn show_dismiss(self, show: bool) -> Snackbar
pub fn show_dismiss(self, show: bool) -> Snackbar
Shows or hides the explicit dismiss button. It is shown by default.
Sourcepub fn action_on_new_line(self, enabled: bool) -> Snackbar
pub fn action_on_new_line(self, enabled: bool) -> Snackbar
Places the action below the message for a long action label.
pub fn shape(self, shape: CornerShape) -> Snackbar
pub fn colors(self, colors: SnackbarColors) -> Snackbar
Auto Trait Implementations§
impl !RefUnwindSafe for Snackbar
impl !Send for Snackbar
impl !Sync for Snackbar
impl !UnwindSafe for Snackbar
impl Forget for Snackbar
impl Freeze for Snackbar
impl Move for Snackbar
impl Unpin for Snackbar
impl UnsafeUnpin for Snackbar
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
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> ⓘ
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