#[repr(C)]pub struct Alert {
pub alert_state: AlertStateWrapper,
pub message: AzString,
pub kind: AlertKind,
pub dismissible: bool,
pub container_style: CssPropertyWithConditionsVec,
}Expand description
A coloured inline message box with an optional dismissible close button.
Fields§
§alert_state: AlertStateWrapperRuntime state (visible) plus the optional dismiss callback.
message: AzStringThe message text shown inside the alert.
kind: AlertKindThe colour variant.
dismissible: boolWhether to render the “x” close button (hides the alert on click).
container_style: CssPropertyWithConditionsVecThe computed inline style for the container.
Implementations§
Source§impl Alert
impl Alert
Sourcepub fn create(message: AzString) -> Self
pub fn create(message: AzString) -> Self
Creates a new informational (blue) alert with the given message.
Sourcepub fn with_kind(message: AzString, kind: AlertKind) -> Self
pub fn with_kind(message: AzString, kind: AlertKind) -> Self
Creates a new alert with the given message and colour variant.
Sourcepub fn set_kind(&mut self, kind: AlertKind)
pub fn set_kind(&mut self, kind: AlertKind)
Sets the colour variant, recomputing the container style.
Sourcepub fn with_alert_kind(self, kind: AlertKind) -> Self
pub fn with_alert_kind(self, kind: AlertKind) -> 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 alert 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<AlertOnDismissCallback>>(
&mut self,
data: RefAny,
on_dismiss: C,
)
pub fn set_on_dismiss<C: Into<AlertOnDismissCallback>>( &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<AlertOnDismissCallback>>(
self,
data: RefAny,
on_dismiss: C,
) -> Self
pub fn with_on_dismiss<C: Into<AlertOnDismissCallback>>( 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) alert and returns the original.
Trait Implementations§
impl Eq for Alert
impl StructuralPartialEq for Alert
Auto Trait Implementations§
impl Freeze for Alert
impl RefUnwindSafe for Alert
impl Send for Alert
impl Sync for Alert
impl Unpin for Alert
impl UnsafeUnpin for Alert
impl UnwindSafe for Alert
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