bevy-website icon indicating copy to clipboard operation
bevy-website copied to clipboard

0.15 migration guide provides incorrect advice about AssetLoader

Open spectria-limina opened this issue 1 year ago • 1 comments

The migration guide for 0.15 suggests that a prototypical implementation of AssetLoader now looks like this:

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<Self::Asset, Self::Error> {
}

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

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

spectria-limina avatar Dec 02 '24 03:12 spectria-limina

This section needs to be consolidated with https://bevyengine.org/learn/migration-guides/0-14-to-0-15/#cleanup-unneeded-lifetimes-in-bevy-asset

rparrett avatar Dec 02 '24 15:12 rparrett