bevyengine / bevyengine/bevy-website

0.15 migration guide provides incorrect advice about AssetLoader

Open
#1,896 1 comment 1 reaction 0 assignees View on GitHub
A-Migration Guides C-Correction
Dominant language
JavaScript
Stars
249
Forks
450
Avg merge
16h 20m
Merged PRs (30d)
6

Description

The migration guide for 0.15 [suggests](https://bevyengine.org/learn/migration-guides/0-14-to-0-15/#assetreader-read-now-returns-an-opaque-type) that a prototypical implementation of `AssetLoader` now looks like this:

```rust
impl AssetLoader for MyLoader {
async fn load<'a>(
&'a self,
reader: &'a mut dyn bevy::asset::io::Reader,
_: &'a Self::Settings,
load_context: &'a mut LoadContext<'_>,
) -> Result {
}
```

However, this is incorrect: the lifetimes are not constrained in the trait to all be equal. The correct implementation is:

```rust
impl AssetLoader for MyLoader {
async fn load(
&self,
reader: &mut dyn bevy::asset::io::Reader,
_: &Self::Settings,
load_context: &mut LoadContext<'_>,
) -> Result {
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.