async_wasm_task
async_wasm_task
is a Rust library that provides an API for managing asynchronous tasks and Rust Future
s in a JavaScript environment, closely resembling the familiar patterns of tokio::task
. It is designed to allow async Rust code to work seamlessly with JavaScript in web applications, leveraging web workers for concurrent task execution.
Features
-
Familiar API: If you're familiar with
tokio::task
, you'll feel right at home withasync_wasm_task
. It provides similar functionality and follows the same patterns for spawning and managing asynchronous tasks. -
Web Worker Integration:
async_wasm_task
adapts to the JavaScript environment by utilizing web workers under the hood. This means you can write Rust code that runs concurrently and efficiently in web applications. -
Spawn Async and Blocking Tasks: You can spawn both asynchronous and blocking tasks. Asynchronous tasks allow you to perform non-blocking operations, while blocking tasks are suitable for compute-heavy or synchronous tasks.
Usage
Add this library to your Cargo.toml
:
[]
= "[latest-version]"
Here's a simple example of how to use async_wasm_task
:
use ;
async
Documentation
Detailed documentation can be found on docs.rs.
Contributing
Contributions are welcome! If you have any suggestions, bug reports, or want to contribute to the development of async_wasm_task
, please open an issue or submit a pull request.