Module task

Source
Expand description

task module provides helper functions for use with async closures that operate uniformly in native (tokio-backed) and WASM (async_std-backed) environments (i.e. a web browser).

Following functions are are available:

  • spawn() - non-blocking spawn of the supplied async closure
  • sleep() - suspends the task for a given Duration
  • yield_now() - yields rust executor
  • yield_executor() - yields to top-level executor (browser async loop)
Blocking spawn is not available as a part of this framework as WASM-browser environment can
not block task execution due to a single-threaded async application environment.

Modules§

wasm
WASM implementation

Macros§

call_async_no_send

Structs§

Interval
Interval stream used by the interval() function to provide a a time interval stream. The stream is backed by tokio interval stream on native platforms and by by the JavaScript setInterval() and clearInterval() APIs in WASM32 environment.

Functions§

dispatch
interval
async interval() function backed by the JavaScript createInterval()
sleep
Waits until duration has elapsed.
spawn
yield_executor
Yields execution back to the Tokio runtime.
yield_now
Yields execution back to the Tokio runtime.