Module toast
Expand description
Toast + ToastStack primitive — transient notifications anchored
top-right of the shell, sinking fallible OS operations
(trash/rename/move/copy), ShellError conversions, and confirmations.
ToastKindmaps toTheme::tokens.colors.semantic.*for the accent bar.Toastis constructed viaToastStack::push, not directly.ToastStackis a ring-buffered list; default TTL isDEFAULT_TTL(3s), default cap isDEFAULT_MAX(5 toasts).
The Widget impl draws each active toast as a stacked floating card with
its severity icon and a dismiss control. The stack advances itself from
crate::time: an app only pushes. Expiry pauses while the pointer is
over the stack, and under the capture clock (--shots) so a scenario can
hold a toast in frame.
Structs§
- Notice
- The one transient message an app shows over its content: a confirmation, something under way, or a failure. The app shows it and paints it where it belongs; the notice keeps its own lifetime and its announcement.
- Toast
- A single toast entry held by a
ToastStack. Entries are produced internally byToastStack::push; shell code does not constructToastvalues directly. - Toast
Card - Immediate-mode content for one notification / toast card, painted by
paint_card. Built fluently:ToastCard::new("Slow network", ToastKind::Warning).body("retrying"). - Toast
Card Hit - Geometry
paint_cardhands back so callers hit-test the card’s interactive regions against widget-owned rects (no bespoke maths). - Toast
Stack - Top-right notification stack with a configurable maximum entry count and TTL-based expiry.
Enums§
- Toast
Anchor - Placement for a transient card painted inside an app’s area.
- Toast
Kind - Severity / category of a toast. Maps to the semantic color ramp in
crate::tokens::Colorsfor the left accent bar.
Constants§
- DEFAULT_
MAX - Default maximum number of simultaneous toasts. When the cap is
exceeded by
ToastStack::pushthe oldest entry is dropped. - DEFAULT_
TTL - Default time-to-live for a freshly pushed toast.
- NOTICE_
LIFETIME - How long a
Noticestays up.
Functions§
- minimum_
card_ height - Minimum height for a compact card with one elided line per text field.
Uses the same normalized text, roles, padding and shared action controls as
paint_card. A host choosing a fixed-width banner must reserve this height before stacking cards; enlarging type must not paint text over its actions. - paint_
card - Paint a toast / notification card into
rectand return the geometry a caller needs to route clicks. The card is width/height-agnostic (it lays out relative torect), so a 48px single-line in-app toast and a 64px three-line OS notification share this one renderer. - paint_
transient - Paint a transient toast in
area, atanchor. - transient_
expired - Whether a transient shown at
shownforttlhas expired. Under the capture clock (--shots) nothing expires, so a scenario that stages a toast keeps it in frame.