Skip to main content

Module wasm_compat

Module wasm_compat 

Source
Expand description

Target-dependent thread bounds, boxed futures, and executor-independent timers.

use rig_http::wasm_compat::WasmBoxedFuture;
let future: WasmBoxedFuture<'_, u32> = Box::pin(async { 42 });

Structs§

Elapsed
Error returned by timeout when the future does not complete in time.

Traits§

WasmCompatSendNon-target_family=wasm
Send on native targets, a no-op marker on browser wasm.
WasmCompatSyncNon-target_family=wasm
Sync on native targets, a no-op marker on browser wasm.

Functions§

sleep
Sleep for duration using the native or browser timer backend of timeout.
timeout
Await future until duration elapses, then drop it and return Elapsed. The future is polled first, even for zero duration; cancellation runs only its drop cleanup. Uses a native timer thread or browser setTimeout, without requiring an executor timer or a feature flag.

Type Aliases§

WasmBoxedFutureNon-target_family=wasm
Boxed future with Send on the same targets as WasmCompatSend.
WasmBoxedStreamNon-target_family=wasm
Boxed stream with Send on the same targets as WasmCompatSend.