Skip to main content

Module task

Module task 

Source
Expand description

The async seam: Spawn for running work off the main thread, Timer for waiting without blocking it, and the two service resources that carry the selected backend through the world.

Lumen ships one implementation of both (lumen-async-tokio), and a crate that needs async work asks the world for SpawnService rather than naming that backend. Nothing installs an async backend by default, so a consumer must have a path that works when the resource is absent: a file dialog, for instance, falls back to a blocking call.

Futures cross the seam boxed (BoxFuture) because both traits are used as trait objects.

Structs§

SpawnService
The executor an app runs async work on, held as a Resource so any crate can reach it without naming a backend.
TimerService
The timer source an app waits on, held as a Resource alongside SpawnService.

Traits§

Spawn
An executor that runs futures away from the tick loop.
Timer
A source of futures that complete after a delay.

Type Aliases§

BoxFuture
A boxed, Send future with a 'static lifetime: what the async seam passes across a trait-object boundary.