Skip to main content

Module runtime

Module runtime 

Source
Expand description

Platform-specific async runtime abstractions.

NodeDB-Lite compiles for native (Tokio) and WASM (wasm-bindgen-futures). This module provides a thin abstraction over the differences so engine code doesn’t need #[cfg] everywhere.

Native (iOS/Android/Desktop): Tokio — spawn, spawn_blocking, sleep, interval. WASM (Browser): wasm-bindgen-futures + gloo-timers — spawn_local, no blocking threads, timer-backed sleep and interval.

Structs§

Interval
A recurring interval timer.
TaskHandle
Handle to a task started by spawn.

Functions§

interval
Create a recurring interval timer that ticks every period.
monotonic_millis_i64
Get a strictly-monotonic system timestamp in milliseconds since Unix epoch.
now_millis
Get the current timestamp in milliseconds since Unix epoch.
now_millis_i64
Get the current timestamp in milliseconds since Unix epoch, as i64.
now_secs
Get the current timestamp in seconds since Unix epoch.
sleep
Sleep for a duration.
spawn
Spawn a future on the runtime, returning a handle to the running task.
spawn_blocking
Run a blocking closure off the async runtime.