{"id":15282704,"url":"https://github.com/loopystudios/bevy_async_task","last_synced_at":"2025-04-04T11:08:42.173Z","repository":{"id":172355344,"uuid":"649027773","full_name":"loopystudios/bevy_async_task","owner":"loopystudios","description":"Cross-platform ergonomic abstractions for async programming in Bevy.","archived":false,"fork":false,"pushed_at":"2025-03-10T04:10:10.000Z","size":109,"stargazers_count":76,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T10:05:37.751Z","etag":null,"topics":["async","bevy","bevy-engine","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/bevy_async_task","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loopystudios.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-03T14:46:06.000Z","updated_at":"2025-03-10T04:10:14.000Z","dependencies_parsed_at":"2024-03-26T14:27:38.638Z","dependency_job_id":"76833c92-7227-4cc5-a52d-f6f7bdd3d208","html_url":"https://github.com/loopystudios/bevy_async_task","commit_stats":{"total_commits":87,"total_committers":5,"mean_commits":17.4,"dds":"0.27586206896551724","last_synced_commit":"5f62a7c855b3fc24788941cf7defbb3e9080eaee"},"previous_names":["vectorgameexperts/bevy-async-task","loopystudios/bevy-async-task","loopystudios/bevy_async_task"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopystudios%2Fbevy_async_task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopystudios%2Fbevy_async_task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopystudios%2Fbevy_async_task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopystudios%2Fbevy_async_task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loopystudios","download_url":"https://codeload.github.com/loopystudios/bevy_async_task/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166167,"owners_count":20894654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","bevy","bevy-engine","rust"],"created_at":"2024-09-30T14:36:23.582Z","updated_at":"2025-04-04T11:08:42.154Z","avatar_url":"https://github.com/loopystudios.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n\n# Bevy Async Task\n\n[![Discord](https://img.shields.io/discord/913957940560531456.svg?label=Loopy\u0026logo=discord\u0026logoColor=ffffff\u0026color=ffffff\u0026labelColor=000000)](https://discord.gg/zrjnQzdjCB)\n![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)\n[![Build status](https://github.com/loopystudios/bevy_async_task/workflows/CI/badge.svg)](https://github.com/loopystudios/bevy_async_task/actions)\n[![Dependency status](https://deps.rs/repo/github/loopystudios/bevy_async_task/status.svg)](https://deps.rs/repo/github/loopystudios/bevy_async_task)\n[![crates.io](https://img.shields.io/crates/v/bevy_async_task.svg)](https://crates.io/crates/bevy_async_task)\n[![docs.rs](https://img.shields.io/docsrs/bevy_async_task)](https://docs.rs/bevy_async_task)\n\nA 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).\n\n\u003c/div\u003e\n\nBevy Async Task provides Bevy system parameters to run asynchronous tasks in the background on web and native with timeouts and output capture.\n\n## Bevy version support\n\n|bevy|bevy_async_task|\n|---|---|\n|0.15|0.3-0.5, main|\n|0.14|0.2|\n|0.13|0.1|\n|\u003c= 0.13|Unsupported|\n\n## Usage\n\nThere are several [examples](examples/) for reference.\n\nYou can also run examples on web:\n\n```shell\n# Make sure the Rust toolchain supports the wasm32 target\nrustup target add wasm32-unknown-unknown\n\ncargo run_wasm --example simple\n```\n\n### Polling in systems\n\nPoll one task at a time with `TaskRunner\u003cT\u003e`:\n\n```rust\nasync fn long_task() -\u003e u32 {\n    sleep(Duration::from_millis(1000)).await;\n    5\n}\n\nfn my_system(mut task_runner: TaskRunner\u003cu32\u003e) {\n    if task_runner.is_idle() {\n        task_executor.start(long_task());\n        info!(\"Started!\");\n    }\n\n    match task_runner.poll() {\n        Poll::Ready(v) =\u003e {\n            info!(\"Received {v:?}\");\n        }\n        Poll::Pending =\u003e {\n            // Waiting...\n        }\n    }\n}\n```\n\nPoll many similar tasks simultaneously with `TaskPool\u003cT\u003e`:\n\n```rust\nfn my_system(mut task_pool: TaskPool\u003cu64\u003e) {\n    if task_pool.is_idle() {\n        info!(\"Queueing 5 tasks...\");\n        for i in 1..=5 {\n            task_pool.spawn(async move { // Closures work too!\n                sleep(Duration::from_millis(i * 1000)).await;\n                i\n            });\n        }\n    }\n\n    for status in task_pool.iter_poll() {\n        if let Poll::Ready(v) = status {\n            info!(\"Received {v:?}\");\n        }\n    }\n}\n```\n\nWe also have a [`cross_system` example](./examples/cross_system.rs).\n\n## Community\n\nAll Loopy projects and development happens in the [Loopy Discord](https://discord.gg/zrjnQzdjCB). The discord is open to the public.\n\nContributions are welcome by pull request. The [Rust code of conduct](https://www.rust-lang.org/policies/code-of-conduct) applies.\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopystudios%2Fbevy_async_task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floopystudios%2Fbevy_async_task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopystudios%2Fbevy_async_task/lists"}