bevy/release-content
andriyDev 723b52abd3
Allow returning an error from labeled_asset_scope. (#19449)
# 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 })
})?;
```
2025-06-04 00:00:32 +00:00
..
migration-guides Allow returning an error from labeled_asset_scope. (#19449) 2025-06-04 00:00:32 +00:00
release-notes Hot patching systems with subsecond (#19309) 2025-06-03 21:12:38 +00:00
migration_guides_template.md Make some changes to the migration guide recommendations (#18794) 2025-04-10 19:25:56 +00:00
migration_guides.md Make some changes to the migration guide recommendations (#18794) 2025-04-10 19:25:56 +00:00
README.md Fixed broken link in release content README. (#19375) 2025-05-26 19:30:03 +00:00
release_notes_template.md
release_notes.md

Release Content

This directory contains drafts of documentation for the current development cycle, which will be published to the website during the next release. You can find more information in the release notes and migration guides files.