Struct patternfly_yew::Toast [−][src]
Toasts are small alerts that get shown on the top right corner of the page.
A toast can be triggered by every component. The toast fill get sent to an agent, the Toaster. The toaster will delegate displaying the toast to an instance of a ToastViewer component.
In order for Toasts to be displayed your application must have exactly one ToastViewer before creating the first Toast.
For example:
pub struct App{ link: ComponentLink<Self> }; pub enum Msg { Toast(Toast), } type Message = Msg; fn update(&mut self, msg: Self::Message) -> bool { match msg { Msg::Toast(toast) => { ToastDispatcher::new().toast(toast); false } } } fn view(&self) -> Html { html!{ <> <ToastViewer/> <div> <button onclick=self.link.callback(|_|{ Msg::Toast("Toast Title".into()) })> { "Click me" } </button> </div> </> } }
Fields
title: String
type: Type
timeout: Option<Duration>
The timeout when the toast will be removed automatically.
If no timeout is set, the toast will get a close button.
body: Html
actions: Vec<Action>
Trait Implementations
impl Clone for Toast
[src]
impl Debug for Toast
[src]
impl Default for Toast
[src]
impl<S: ToString> From<S> for Toast
[src]
Allows to convert a string into a toast by using the string as title.
Auto Trait Implementations
impl !RefUnwindSafe for Toast
[src]
impl !Send for Toast
[src]
impl !Sync for Toast
[src]
impl Unpin for Toast
[src]
impl !UnwindSafe for Toast
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,