Fix AssetServer lifetimes (#15533)

# Objective

- Adds a separate lifetimes for AssetSourceId
This commit is contained in:
ChosenName 2024-09-30 12:19:27 -06:00 committed by GitHub
parent cedd0c5028
commit 07caf35da4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,9 +131,9 @@ impl AssetServer {
} }
/// Retrieves the [`AssetSource`] for the given `source`. /// Retrieves the [`AssetSource`] for the given `source`.
pub fn get_source<'a>( pub fn get_source<'a, 'b>(
&'a self, &'a self,
source: impl Into<AssetSourceId<'a>>, source: impl Into<AssetSourceId<'b>>,
) -> Result<&'a AssetSource, MissingAssetSourceError> { ) -> Result<&'a AssetSource, MissingAssetSourceError> {
self.data.sources.get(source.into()) self.data.sources.get(source.into())
} }
@ -218,9 +218,9 @@ impl AssetServer {
} }
/// Retrieves the default [`AssetLoader`] for the given path, if one can be found. /// Retrieves the default [`AssetLoader`] for the given path, if one can be found.
pub async fn get_path_asset_loader<'a>( pub async fn get_path_asset_loader<'a, 'b>(
&self, &self,
path: impl Into<AssetPath<'a>>, path: impl Into<AssetPath<'b>>,
) -> Result<Arc<dyn ErasedAssetLoader>, MissingAssetLoaderForExtensionError> { ) -> Result<Arc<dyn ErasedAssetLoader>, MissingAssetLoaderForExtensionError> {
let path = path.into(); let path = path.into();