pub struct Toasts { /* private fields */ }Expand description
A handle to show toasts from anywhere (event handlers, async tasks).
Place one Toaster in the UI to display them.
use ravenrs_widgets::{Toaster, Toasts, Tone, Ui};
let toasts = Toasts::new();
let mut ui = Ui::new(Toaster::new(toasts.clone()), ravenrs_style::Theme::raven_dark());
toasts.show("Saved", "Your changes are stored.", Tone::Success);
assert_eq!(toasts.len(), 1);
ui.update();Implementations§
Source§impl Toasts
impl Toasts
Sourcepub fn show(
&self,
title: impl Into<String>,
message: impl Into<String>,
tone: Tone,
)
pub fn show( &self, title: impl Into<String>, message: impl Into<String>, tone: Tone, )
Shows a toast for 4 seconds.
Sourcepub fn show_for(
&self,
title: impl Into<String>,
message: impl Into<String>,
tone: Tone,
seconds: f64,
)
pub fn show_for( &self, title: impl Into<String>, message: impl Into<String>, tone: Tone, seconds: f64, )
Shows a toast for seconds seconds. At most four are kept; the oldest go first.
Sourcepub fn show_until_closed(
&self,
title: impl Into<String>,
message: impl Into<String>,
tone: Tone,
)
pub fn show_until_closed( &self, title: impl Into<String>, message: impl Into<String>, tone: Tone, )
Shows a toast that stays until a person closes it or Self::dismiss does.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Toasts
impl !Send for Toasts
impl !Sync for Toasts
impl !UnwindSafe for Toasts
impl Freeze for Toasts
impl Unpin for Toasts
impl UnsafeUnpin for Toasts
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