Previously, I had this code:
impl AssetLoader for MapAssetLoader {
type Asset = MapAsset;
type Settings = ();
type Error = MapAssetLoaderError;
async fn load<'a>(
&'a self,
reader: &'a mut Reader<'_>,
_settings: &'a Self::Settings,
load_context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
load::load(reader, load_context, false).await
}
fn extensions(&self) -> &[&str] {
&["map"]
}
}
And i get an error regarding the function signature. After consulting the change logs, I saw Reader became a trait, so i changed my function as such, as recommended by the docs:
async fn load<'a>(
&'a self,
reader: &'a dyn Reader,
_settings: &'a Self::Settings,
load_context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
load::load(reader, load_context, false).await
}
However, This still produces multiple compiler errors:
- LoadContext's reference lifetime lives longer than the data, which makes sense since 'a lives longer than '_. But the docs dont say to do this so i dont know
- The load function signature isnt correct (the error for this is wayy to long and verbose)
Any help would be very much appreciated, thanks in advace! :D