Skip to main content

Module toast

Module toast 

Source
Expand description

Toast notification — stackable, action-rich, severity-aware floating notification (the “upgrade path” from Snackbar).

Distinct from siblings:

  • Snackbar — single-instance, message-only. Calling present_snackbar dismisses all other overlays first.
  • Banner — persistent inline strip, not a floating overlay.
  • MessageBox — modal dialog. Blocks interaction with the rest of the UI.

A Toast is built with one of the four severity constructors (info / success / warning / error) plus a loading variant, configured via builder methods, and presented with ctx.show_toast(toast) (see toast::ext::EventContextToastExt) or toast.present(ctx). A ToastHost installed via TeksiloAppBuilder.install_toast(opts) from the teksilo umbrella accepts the request, picks a free slot from its pool, and mounts a ToastSurface at the configured viewport corner using the OverlayPlacement::ViewportCorner variant.

ctx.show_toast(
    Toast::warning(tr!(unsaved_changes()))
        .body(tr!(close_anyway_question()))
        .action(ToastAction::primary(tr!(save()), |c| c.send_intent(AppIntent::Save)))
        .action(ToastAction::new(tr!(discard()), |c| c.send_intent(AppIntent::Discard)))
);

Re-exports§

pub use body::TOAST_BODY_COLLAPSED_LINES;
pub use ext::EventContextToastExt;
pub use host::ToastHost;
pub use host::ToastInstallOptions;
pub use registry::ToastRegistry;
pub use surface::ToastSurface;

Modules§

body
CollapsibleBody — a toast body that clamps to a few lines and offers to unfold.
ext
Extension methods on [EventContext] for showing and dismissing toasts. Mirrors the EventContextFileDialogExt pattern from teksilo-platform.
host
ToastHost — invisible sibling widget that owns the toast queue.
registry
ToastRegistry — the app-singleton service handle.
surface
ToastSurface — the rendered chrome of one toast.

Structs§

Toast
Toast — a present-able request (NOT a Widget). Construct with one of the severity-named constructors, configure via builder methods, then call .present(ctx) or ctx.show_toast(self). Internally the builder is consumed and its data is moved into a slot on the installed ToastHost.
ToastAction
One actionable element inside a Toast — a button or hyperlink the user can click to drive a domain action.
ToastAudience
Opaque per-app routing token. teksilo has no notion of what an “audience” means to the host app (a document, a project, a user session, …) — it only ever compares and hashes this value. Apps mint their own tokens (typically one per open document/window group) via ToastAudience::new and pass the same value to Toast::target(...) and ToastRegistry::set_window_audience(...) to link the two sides of the routing decision.
ToastHandle
Returned by Toast::present (and ctx.show_toast(toast)). Cheap to clone (Rc<Inner>). Lets app code dismiss the toast programmatically or check whether it is still alive.
ToastStyleConfig

Enums§

ToastActionStyle
How a ToastAction should be rendered inside the toast surface.
ToastDismissCause
Why a toast was dismissed — delivered to the on_dismiss callback.
ToastPriority
Queue / assertiveness level — shared with the public Toast builder API. Lives here in teksilo-core so the style trait can take it in its config without depending on teksilo-widgets.
ToastRoute
Resolved delivery target for a toast (and, mirrored, its archived NotificationEntry).
ToastSeverity
Toast severity — re-export of BannerSeverity so apps that mix Banner and Toast share one severity vocabulary. The same severity.surface() / severity.glyph_color(theme) helpers apply. Banner severity level. Drives the surface tint, glyph color, and glyph shape. Apps with a “neutral” callout requirement should use a Card instead.

Constants§

DEFAULT_TOAST_AUTO_DISMISS
Default auto-dismiss duration when the caller does not override it (matches IntelliJ BALLOON and Material Snackbar maximum).

Type Aliases§

ToastActionCallback
Type-erased callback for a ToastAction. Fn (not FnMut) so the same callback can be wrapped in an Rc and dispatched from multiple paths (tap, keyboard, AT custom action).
ToastDismissCallback
Type-erased on_dismiss callback receiving the cause + context.