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§
- Spawn
Service - The executor an app runs async work on, held as a
Resourceso any crate can reach it without naming a backend. - Timer
Service - The timer source an app waits on, held as a
ResourcealongsideSpawnService.
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,
Sendfuture with a'staticlifetime: what the async seam passes across a trait-object boundary.