bevy/crates/bevy_asset
Mincong Lu 1d950e6195
Allow AssetServer::load to acquire a guard item. (#13051)
# Objective

Supercedes #12881 . Added a simple implementation that allows the user
to react to multiple asset loads both synchronously and asynchronously.

## Solution

Added `load_acquire`, that holds an item and drops it when loading is
finished or failed.

When used synchronously 

Hold an `Arc<()>`, check for `Arc::strong_count() == 1` when all loading
completed.

When used asynchronously 

Hold a `SemaphoreGuard`, await on `acquire_all` for completion.

This implementation has more freedom than the original in my opinion.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Zachary Harrold <zac@harrold.com.au>
2024-05-23 13:28:29 +00:00
..
macros Make feature(doc_auto_cfg) work (#12642) 2024-03-23 02:22:52 +00:00
src Allow AssetServer::load to acquire a guard item. (#13051) 2024-05-23 13:28:29 +00:00
Cargo.toml bevy_asset: Add missing web-sys feature and cleanup unused ones (#13281) 2024-05-12 20:53:59 +00:00
README.md Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00

Bevy Asset

License Crates.io Downloads Docs Discord