#async-executor #yield #async

yielding-executor

Async executor with configurable yielding

1 unstable release

0.10.0 Jun 30, 2022

#1428 in WebAssembly


Used in 3 crates (via wasmflow-component)

MIT/Apache

25KB
574 lines

Yielding Executor for WebAssembly

Crate API

This executor is a fork of wasm-rs-async-executor decoupled from wasm-bindgen.

There are a number of async task executors available in Rust's ecosystem. However, most (if not all?) of them rely on primitives that might not be available or optimal for WebAssembly deployment at the time and rely on the ability to monopolize a thread until completion. This crate gives you a simple executor that you can configure to yield in arbitrary ways.

Usage

Include this dependency in your Cargo.toml:

[dependencies]
yielding-executor = "0.9.0"

yielding-executor is expected to work on stable Rust, 1.49.0 and higher up.

Supported targets

This crate passes tests for wasm32-unknown-unknown and wasm32-wasi targets and should not really be used for anything else. There are better executors for other targets.

Notes

Please note that this library hasn't received much analysis in terms of safety and soundness. Some of the caveats related to that might never be resolved completely. This is an ongoing development and the maintainer is aware of potential pitfalls. Any productive reports of unsafeties or unsoundness are welcomed (whether they can be resolved or simply walled with unsafe for end-user to note).

License

Licensed under either of

Dependencies

~1–1.6MB
~33K SLoC