nuzzles
bevy_async_task
Rust

Cross-platform ergonomic abstractions for async programming in Bevy.

Last updated Jun 25, 2026
89
Stars
11
Forks
1
Issues
0
Stars/day
Attention Score
44
Language breakdown
No language data available.
โ–ธ Files click to expand
README

Bevy Async Task

Discord MIT/Apache 2.0 Following released Bevy versions\ Dependency status crates.io docs.rs Build status

A minimum crate for ergonomic abstractions to async programming in Bevy. There is full API support for wasm and native. Android and iOS are untested (Help needed).

Bevy Async Task provides Bevy system parameters to run asynchronous tasks in the background on web and native with timeouts and output capture.

Bevy version support

|bevy|bevyasynctask| |---|---| |0.19|0.13,main| |0.18|0.12| |0.17|0.9-0.11| |0.16|0.6-0.8| |0.15|0.3-0.5| |0.14|0.2| |0.13|0.1| |<= 0.13|Unsupported|

Usage

There are several examples for reference.

You can also run examples on web:

# Make sure the Rust toolchain supports the wasm32 target
rustup target add wasm32-unknown-unknown

cargo run_wasm --example simple

Polling in systems

Poll one task at a time with TaskRunner<T>:

async fn long_task() -> u32 {
    sleep(Duration::from_millis(1000)).await;
    5
}

fn mysystem(mut taskrunner: TaskRunner<u32>) { if taskrunner.isidle() { taskexecutor.start(longtask()); info!("Started!"); }

match task_runner.poll() { Poll::Ready(v) => { info!("Received {v:?}"); } Poll::Pending => { // Waiting... } } }

Poll many similar tasks simultaneously with TaskPool<T>:

fn mysystem(mut taskpool: TaskPool<u64>) {
    if taskpool.isidle() {
        info!("Queueing 5 tasks...");
        for i in 1..=5 {
            task_pool.spawn(async move { // Closures work too!
                sleep(Duration::from_millis(i * 1000)).await;
                i
            });
        }
    }

for status in taskpool.iterpoll() { if let Poll::Ready(v) = status { info!("Received {v:?}"); } } }

We also have a cross_system example.

Community

All Loopy projects and development happens in the Loopy Discord. The discord is open to the public.

Contributions are welcome by pull request. The Rust code of conduct applies.

License

Licensed under either of

  • Apache License, Version 2.0
(LICENSE-APACHE or )
  • MIT license
(LICENSE-MIT or )

at your option

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท nuzzles/bevy_async_task ยท Updated daily from GitHub