Skip to main content

Crate tokio_immediate

Crate tokio_immediate 

Source
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

Re-exports§

pub use ::tokio;

Modules§

parallel
Async parallel runner: schedule futures to run concurrently. Async parallel runner: execute submitted futures concurrently.
serialsync
Async serial runner: schedule futures to run one after another. Async serial runner: execute submitted futures one after another.
single
Async call: spawn one Future and track its result. Async call: spawn one Future and track its result.
syncsync
Wrappers around tokio::sync primitives that wake up viewports on send.
triggersync
A notification channel for signaling async tasks from the UI thread.

Structs§

AsyncCurrentRuntime
The default AsyncRuntime for AsyncCall.
AsyncViewport
Represents a single GUI viewport (window) that can be woken up from asynchronous tasks.
AsyncWakeUpGuard
RAII guard that wakes up on drop.
AsyncWaker
A lightweight, cloneable handle that can request a repaint of the AsyncViewport it was created from.
AsyncWakerList
A thread-safe collection of AsyncWakers that can all be woken up at once.

Traits§

AsyncRuntime
Abstraction over how AsyncCall accesses a Tokio runtime.
AsyncWakeUp
Common interface for types that can request a viewport wake-up.

Type Aliases§

AsyncWakeUpCallback