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§

WasmCompatSendNot (target_os=unknown and WebAssembly)
Send on native targets, a no-op marker on browser wasm.
WasmCompatSendStreamNot (target_os=unknown and WebAssembly)
Streaming response bound that includes Send on native targets.
WasmCompatSyncNot (target_os=unknown and WebAssembly)
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§

WasmBoxedFutureNot (target_os=unknown and WebAssembly)
Boxed future with Send on the same targets as WasmCompatSend.
WasmBoxedStreamNot (target_os=unknown and WebAssembly)
Boxed stream with Send on the same targets as WasmCompatSend.