bevy/crates/bevy_asset/src
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
..
io Misc asset code quality and docs (#13382) 2024-05-15 18:49:04 +00:00
processor Misc asset code quality and docs (#13382) 2024-05-15 18:49:04 +00:00
server Allow AssetServer::load to acquire a guard item. (#13051) 2024-05-23 13:28:29 +00:00
assets.rs Fix beta lints (#12980) 2024-04-16 02:46:46 +00:00
direct_access_ext.rs Add methods to directly load assets from World (#12023) 2024-02-27 00:28:26 +00:00
event.rs Added AssetLoadFailedEvent, UntypedAssetLoadFailedEvent (#11369) 2024-01-17 21:12:00 +00:00
folder.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
handle.rs Allow converting mutable handle borrows to AssetId. (#12759) 2024-03-28 15:53:26 +00:00
id.rs Implement the AnimationGraph, allowing for multiple animations to be blended together. (#11989) 2024-03-07 20:22:42 +00:00
lib.rs Make LoadContext use the builder pattern for loading dependent assets (#13465) 2024-05-22 23:35:41 +00:00
loader_builders.rs Allow AssetServer::load to acquire a guard item. (#13051) 2024-05-23 13:28:29 +00:00
loader.rs Make LoadContext use the builder pattern for loading dependent assets (#13465) 2024-05-22 23:35:41 +00:00
meta.rs Add more load_direct implementations (#13415) 2024-05-21 18:32:00 +00:00
path.rs Ignore query parameters in AssetPaths when determining the extension (#12828) 2024-04-03 18:57:03 +00:00
reflect.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
saver.rs Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
transformer.rs Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00