cross-runtime 0.1.0

One task, timer, and runtime surface across native Tokio and browser WebAssembly
Documentation

cross-runtime

One task, timer, and runtime surface across native Tokio and browser WebAssembly.

let task = xrt::spawn(async { 42 });
assert_eq!(task.await?, 42);
xrt::sleep(std::time::Duration::from_millis(1)).await;

The package is named cross-runtime; consumers may use the compact crate name:

xrt = { package = "cross-runtime", version = "0.1" }

Runtime mapping

Surface Native wasm32-unknown-unknown
spawn Tokio Send task web-task Send task
spawn_local current Tokio LocalSet current browser thread
Runtime owned or injected Tokio runtime ambient browser runtime
sleep, timeout Tokio clock wasmtimer browser clock

JoinHandle follows Tokio lifecycle semantics on both targets: dropping a handle detaches the task, while abort() requests cancellation.

Browser tests

The browser suite runs the #[wasm_bindgen_test] cases inside a real headless Chrome instance through ChromeDriver:

wasm-pack test --headless --chrome

This is the behavioral gate for browser scheduling, detachment, cancellation, and timer semantics; compiling the wasm test artifacts alone does not exercise them.

License

Licensed under either Apache-2.0 or MIT, at your option.