#[repr(C)]pub struct Toast {
pub toast_state: ToastStateWrapper,
pub message: AzString,
pub kind: ToastKind,
pub dismissible: bool,
pub container_style: CssPropertyWithConditionsVec,
}Expand description
A transient, floating notification banner with a “x” dismiss button.
Fields§
§toast_state: ToastStateWrapperRuntime state (visible) plus the optional dismiss callback.
message: AzStringThe message text shown inside the toast.
kind: ToastKindThe colour variant.
dismissible: boolWhether to render the “x” close button (default true — the only way to
dismiss; see the module-level auto-dismiss TODO2).
container_style: CssPropertyWithConditionsVecThe computed inline style for the (absolutely-positioned) container.
Implementations§
Source§impl Toast
impl Toast
Sourcepub fn create(message: AzString) -> Self
pub fn create(message: AzString) -> Self
Creates a new informational (blue) toast with the given message (visible, with a “x” close button).
Sourcepub fn with_kind(message: AzString, kind: ToastKind) -> Self
pub fn with_kind(message: AzString, kind: ToastKind) -> Self
Creates a new toast with the given message and colour variant.
Sourcepub fn set_kind(&mut self, kind: ToastKind)
pub fn set_kind(&mut self, kind: ToastKind)
Sets the colour variant, recomputing the container style.
Sourcepub fn with_toast_kind(self, kind: ToastKind) -> Self
pub fn with_toast_kind(self, kind: ToastKind) -> Self
Builder-style setter for the colour variant.
Sourcepub const fn set_dismissible(&mut self, dismissible: bool)
pub const fn set_dismissible(&mut self, dismissible: bool)
Sets whether the toast shows a “x” close button.
Sourcepub const fn with_dismissible(self, dismissible: bool) -> Self
pub const fn with_dismissible(self, dismissible: bool) -> Self
Builder-style setter for the dismissible flag.
Sourcepub fn set_on_dismiss<C: Into<ToastOnDismissCallback>>(
&mut self,
data: RefAny,
on_dismiss: C,
)
pub fn set_on_dismiss<C: Into<ToastOnDismissCallback>>( &mut self, data: RefAny, on_dismiss: C, )
Sets the dismiss callback. Implies dismissible = true so the close
button is rendered.
Sourcepub fn with_on_dismiss<C: Into<ToastOnDismissCallback>>(
self,
data: RefAny,
on_dismiss: C,
) -> Self
pub fn with_on_dismiss<C: Into<ToastOnDismissCallback>>( self, data: RefAny, on_dismiss: C, ) -> Self
Builder-style setter for the dismiss callback (implies dismissible).
Sourcepub fn swap_with_default(&mut self) -> Self
pub fn swap_with_default(&mut self) -> Self
Replaces self with a default (empty info) toast and returns the original.
Trait Implementations§
impl Eq for Toast
impl StructuralPartialEq for Toast
Auto Trait Implementations§
impl Freeze for Toast
impl RefUnwindSafe for Toast
impl Send for Toast
impl Sync for Toast
impl Unpin for Toast
impl UnsafeUnpin for Toast
impl UnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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