bevy-website
bevy-website copied to clipboard
0.15 migration guide provides incorrect advice about AssetLoader
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> {
}
This section needs to be consolidated with https://bevyengine.org/learn/migration-guides/0-14-to-0-15/#cleanup-unneeded-lifetimes-in-bevy-asset