Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ToastSurface

ToastSurface — the rendered chrome of one toast.

Public types

KindName
structToastSurfaceData — Snapshot data passed to a ToastSurface for one live entry
structToastSurface — One rendered toast — chrome owned by ToastStyle::make_body, functional pieces (glyph, body, action row, close button) owned by this widget

Public functions

ToastSurface

Detailed description

Built by ToastHost for each live entry. Owns the severity glyph, title + body column, action row, close button, and the Role::Alert / Role::Status AccessKit node mapping. The visual chrome (background, padding, layout) is delegated to the active ToastStyle via make_body.

An update in place (Toast::id) rebuilds the surface of that one entry, and the rebuild reconciles: the surface's own node stays (so the toast is announced again only if its name changed), and the glyph, title, body, each action and the close button are kept when the update left them as they were. A progress toast updated every 160 ms therefore keeps the Cancel a keyboard user is on, and a kept action calls the action of the latest update, not of the one that built it.

API reference

📖 Full rustdoc API for this module

pub struct ToastSurfaceData

Import: use teksilo::widgets::toast::surface::ToastSurfaceData;

Snapshot data passed to a ToastSurface for one live entry. Owned by the host's LiveEntry and cloned into the surface at build time. Rc<...> fields keep callbacks cheap to copy.

#![allow(unused)]
fn main() {
pub struct ToastSurfaceData { /* fields */ }
}

Fields

  • entry_id: u64
  • severity: ToastSeverity
  • priority: teksilo_core::styles::ToastPriority
  • title: LocalizedString
  • body: Option<LocalizedString>
  • announcement: Option<LocalizedString>
  • actions: Rc<Vec<ToastAction>>
  • show_close_button: bool
  • on_click: Option<Rc<dyn Fn(&mut teksilo_core::widget::EventContext)>>
  • style_override: Option<SharedToastStyle>
  • body_state: teksilo_core::signal::Signal<u8> — Clamped / unfolded state of the body, owned by the live entry so it survives the host's surface rebuilds — see LiveEntry::body_state.

pub struct ToastSurface

Import: use teksilo::widgets::ToastSurface;

One rendered toast — chrome owned by ToastStyle::make_body, functional pieces (glyph, body, action row, close button) owned by this widget. Built once per entry by the host; an update in place rebuilds it and keeps what did not change (see the module docs).

#![allow(unused)]
fn main() {
pub struct ToastSurface { /* fields */ }
}

Methods

pub fn new( data: ToastSurfaceData, leading_widget: Option<Box<dyn Widget>>, registry: ToastRegistry, closable_on_escape: bool, ) -> Self

Build a surface for a single live toast entry. Called by ToastHost once per live registry entry during each rebuild pass. leading_widget is Some for Toast::loading (a spinner) and None for severity-glyph entries (a SeverityBadge is synthesised in build). closable_on_escape mirrors the matching Toast field.

pub fn _default_dismiss(...) (hidden)

Convert milliseconds to a Duration — used for default tests.

#![allow(unused)]
fn main() {
pub fn _default_dismiss() -> std::time::Duration;
}