Struct ToastCard
pub struct ToastCard<'a> {Show 17 fields
pub title: &'a str,
pub body: &'a str,
pub caption: &'a str,
pub kind: ToastKind,
pub alpha: f32,
pub closable: bool,
pub close_hovered: bool,
pub close_pressed: bool,
pub actionable: bool,
pub secondary_action: &'a str,
pub secondary_action_icon: Option<Icon>,
pub secondary_action_hovered: bool,
pub secondary_action_pressed: bool,
pub primary_action: &'a str,
pub primary_action_icon: Option<Icon>,
pub primary_action_hovered: bool,
pub primary_action_pressed: bool,
}Expand description
Immediate-mode content for one notification / toast card, painted by
paint_card. Built fluently:
ToastCard::new("Slow network", ToastKind::Warning).body("retrying").
Fields§
§title: &'a strPrimary line — the summary. Semibold, text_primary.
body: &'a strOptional secondary line (dim). Empty = single-line card.
caption: &'a strOptional attribution caption above the title (e.g. the sending app’s
name), a dim Caption in sentence case. Empty = no caption.
kind: ToastKindSeverity — drives the leading icon and its colour.
alpha: f32Enter/exit animation opacity in [0, 1]; 1.0 for a settled card.
closable: boolDraw a dismiss (X) button at the top-right and hand its rect back
via ToastCardHit so the caller keeps one hit-test on widget-owned
geometry.
close_hovered: boolHover state for the dismiss button, when the caller tracks the cursor.
close_pressed: boolWhether the shared pointer controller has armed this control.
actionable: boolDraw an “actionable” chevron at the trailing edge (the card carries activatable actions).
secondary_action: &'a strOptional left/secondary and right/primary actions. These use the same
immediate-mode Button painter as ordinary retained controls, so a
notification can ask for a decision without inventing a second button
language. Empty labels omit the action row entirely.
secondary_action_icon: Option<Icon>§secondary_action_hovered: bool§secondary_action_pressed: boolWhether the shared pointer controller has armed this control.
primary_action: &'a str§primary_action_icon: Option<Icon>§primary_action_hovered: bool§primary_action_pressed: boolWhether the shared pointer controller has armed this control.
Implementations§
§impl<'a> ToastCard<'a>
impl<'a> ToastCard<'a>
pub fn new(title: &'a str, kind: ToastKind) -> ToastCard<'a>
pub fn body(self, body: &'a str) -> ToastCard<'a>
pub fn caption(self, caption: &'a str) -> ToastCard<'a>
pub fn alpha(self, alpha: f32) -> ToastCard<'a>
pub fn closable(self, v: bool) -> ToastCard<'a>
pub fn close_hovered(self, v: bool) -> ToastCard<'a>
pub fn actionable(self, v: bool) -> ToastCard<'a>
pub fn action(self, label: &'a str, hovered: bool) -> ToastCard<'a>
pub fn action(self, label: &'a str, hovered: bool) -> ToastCard<'a>
One action, at the card’s trailing edge beside its text (“Undo”, “Open”).
pub fn actions(
self,
secondary: &'a str,
secondary_icon: Icon,
secondary_hovered: bool,
primary: &'a str,
primary_icon: Icon,
primary_hovered: bool,
) -> ToastCard<'a>
pub fn actions( self, secondary: &'a str, secondary_icon: Icon, secondary_hovered: bool, primary: &'a str, primary_icon: Icon, primary_hovered: bool, ) -> ToastCard<'a>
Add a standard two-choice action row. The secondary action is painted neutral on the left; the primary action is painted with the theme’s primary face on the right.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ToastCard<'a>
impl<'a> RefUnwindSafe for ToastCard<'a>
impl<'a> Send for ToastCard<'a>
impl<'a> Sync for ToastCard<'a>
impl<'a> Unpin for ToastCard<'a>
impl<'a> UnsafeUnpin for ToastCard<'a>
impl<'a> UnwindSafe for ToastCard<'a>
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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