Expand description
Task and timer facade: tokio natively, the browser event loop on wasm32.
wasm32-unknown-unknown has no threads and no tokio driver, so spawns go to
spawn_local and timers to setTimeout. Signatures match tokio’s so call
sites read the same on both targets.
Re-exports§
pub use web_time as time_std;
Modules§
Structs§
- Join
Error - Task failed to execute to completion.
- Join
Handle - An owned permission to join on a task (await its termination).
Traits§
- Maybe
Send Sendnatively; nothing on wasm32, where there is one thread and browser futures hold!SendJS handles.
Functions§
- can_
spawn - Whether work can be spawned from here: natively only inside a tokio runtime (a drop off-runtime, or during shutdown, has none); always in the browser, whose event loop is the runtime.
- spawn
- Spawns a new asynchronous task, returning a
JoinHandlefor it. - spawn_
blocking - Runs the provided closure on a thread where blocking is acceptable.
- yield_
now - Yields execution back to the Tokio runtime.