toast_host
pub fn toast_host() ToastHostPurpose
Toast host.
Parameters
No arguments are required.
Returns
ToastHost — a value of this type
Present transient notifications in one place
Run the Xu exampleThe example executes in the browser using the Xu/WASM runtime.
Show a notification and dismiss it.
Manage transient notices in one host. Do not expose important errors only through disappearing notifications; keep undo and dismiss actions accessible.
ToastHost is a notification queue owned and presented by the application.
#ui/widgets
fn notifications() widgets.ToastHost {
$host := widgets.toast_host()
value := widgets.notice(&"Workspace saved")
host.enqueue(&value) or >>
<< host
}
toast_hostpub fn toast_host() ToastHostToast host.
No arguments are required.
ToastHost — a value of this type
The application owns the component. Screen.place positions nodes; Screen.set_enabled and Screen.set_visible control availability and visibility. Present again after state changes, handle or errors, and keep topology changes outside paint callbacks. ToastHost uses its own queue API.
Action · Styles · UI lifecycle and styling guide
struct ToastHostpub struct ToastHost {
}Bounded, stable-priority queue. Expiry starts when a renderer displays a record, never while it is waiting. Keys replace pending copies in place.
This type has no public fields.
(&ToastHost) pending_countpub fn (host &ToastHost) pending_count() intOperation on &ToastHost: pending count.
host &ToastHostToastHost instance used by this call (borrow).int — a value of this type
($&ToastHost) set_capacitypub fn (host $&ToastHost) set_capacity(capacity int) intOperation on $&ToastHost: set capacity. Throws on failure; handle the error or propagate it to the caller.
host $&ToastHostToastHost instance used by this call (exclusive borrow).capacity intint — a value of this type
($&ToastHost) enqueuepub fn (host $&ToastHost) enqueue(value &Notice) intExecute enqueue on $&ToastHost. Throws on failure; handle the error or propagate it to the caller.
host $&ToastHostToastHost instance used by this call (exclusive borrow).value &Noticeint — a value of this type
($&ToastHost) next_noticepub fn (host $&ToastHost) next_notice() NoticeRecordOperation on $&ToastHost: next notice. Throws on failure; handle the error or propagate it to the caller.
host $&ToastHostToastHost instance used by this call (exclusive borrow).NoticeRecord — a value of this type