Expand description
Async on the UI thread: a small executor driven by Ui::tick, timers
on a swappable clock, and a bridge for work done on other threads.
spawn_localruns a future on the UI thread. It is owned by the current reactive scope and cancelled when that scope is disposed. Stores’ actions useStore::spawn, which runs it in the store’s scope.spawn_blockingruns a closure on a background thread and resolves (on the UI thread) with its result.sleepwaits on theUi’s clock: real time in apps, a manual clock in tests.
Structs§
- Manual
Clock - A clock that only moves when told to. Share it with
Rcto advance it. - Sleep
- Future returned by
sleep. - System
Clock - Real, monotonic time.
- Task
Handle - Handle to a task started with
spawn_local.
Traits§
- Clock
- Time as the UI sees it. Apps use real time; tests use a manual clock.
Functions§
- sleep
- Waits
durationon the currentUi’s clock. - spawn_
blocking - Runs
workon a background thread; the returned future resolves on the UI thread with its result. - spawn_
local - Runs
futureon the UI thread. It is cancelled when the current reactive scope (e.g. the component that started it) is disposed. A store’s action is called in its caller’s scope: it spawns withStore::spawninstead.