Struct patternfly_yew::Toast [−][src]
pub struct Toast {
pub title: String,
pub type: Type,
pub timeout: Option<Duration>,
pub body: Html,
pub actions: Vec<Action>,
}Expand description
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: Stringtype: Typetimeout: Option<Duration>The timeout when the toast will be removed automatically.
If no timeout is set, the toast will get a close button.
body: Htmlactions: Vec<Action>Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Toast
impl !Send for Toast
impl !Sync for Toast
impl Unpin for Toast
impl !UnwindSafe for Toast
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> Any for T where
T: Any,
T: Any,
impl<T> CloneAny for T where
T: Any + Clone,
T: Any + Clone,