Expand description
Primitives for calling asynchronous code from immediate mode GUIs.
The single module contains AsyncCall, which spawns a single
Future onto a Tokio runtime and exposes its result through a
poll-based API that fits naturally into an immediate mode update loop.
An AsyncViewport ties a GUI viewport to a wake-up callback so
that completed tasks automatically trigger a repaint.
With the sync feature enabled, the sync and trigger modules
provide channel wrappers that wake viewports when values are sent,
enabling continuous progress reporting from async tasks to the UI.
The parallel module provides AsyncParallelRunner.
The serial module is enabled by the sync feature and provides
AsyncSerialRunner.
§Feature flags
sync— Enable viewport-aware wrappers aroundtokio::syncchannels, atriggernotification channel andserial::AsyncSerialRunner.
Re-exports§
pub use ::tokio;
Modules§
- parallel
- Async parallel runner: schedule futures to run concurrently. Async parallel runner: execute submitted futures concurrently.
- serial
sync - Async serial runner: schedule futures to run one after another. Async serial runner: execute submitted futures one after another.
- single
- Async call: spawn one
Futureand track its result. Async call: spawn oneFutureand track its result. - sync
sync - Wrappers around
tokio::syncprimitives that wake up viewports on send. - trigger
sync - A notification channel for signaling async tasks from the UI thread.
Structs§
- Async
Current Runtime - The default
AsyncRuntimeforAsyncCall. - Async
Viewport - Represents a single GUI viewport (window) that can be woken up from asynchronous tasks.
- Async
Wake UpGuard - RAII guard that wakes up on drop.
- Async
Waker - A lightweight, cloneable handle that can request a repaint of the
AsyncViewportit was created from. - Async
Waker List - A thread-safe collection of
AsyncWakers that can all be woken up at once.
Traits§
- Async
Runtime - Abstraction over how
AsyncCallaccesses a Tokio runtime. - Async
Wake Up - Common interface for types that can request a viewport wake-up.