![]() # Objective - `LoadContext::labeled_asset_scope` cannot return errors back to the asset loader. This means users that need errors need to fall back to using the raw `begin_labeled_asset` and `add_loaded_labeled_asset`, which is more error-prone. ## Solution - Allow returning a (generic) error from `labeled_asset_scope`. - This has the unfortunate side effect that closures which don't return any errors need to A) return Ok at the end, B) need to specify an error type (e.g., `()`). --- ## Showcase ```rust // impl AssetLoader for MyLoader let handle = load_context.labeled_asset_scope("MySubasset", |mut load_context| { if !some_precondition { return Err(ThingsDontMakeSenseError); } let handle = load_context.add_labeled_asset("MySubasset/Other", SomeOtherThing(456)); Ok(Something{ id: 123, handle }) })?; ``` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |