pub trait AssetLoader {
// Required method
fn load_asset(
&self,
handler: &mut dyn AssetCreationHandler,
identifier: &str,
) -> Option<AnyHandle<dyn Any>>;
}Expand description
An AssetLoader loads an asset given its name, with help from an AssetCreationHandler. Some AssetLoaders implement special behaviour, such as caching or combining multiple child loaders.
Required Methods§
Sourcefn load_asset(
&self,
handler: &mut dyn AssetCreationHandler,
identifier: &str,
) -> Option<AnyHandle<dyn Any>>
fn load_asset( &self, handler: &mut dyn AssetCreationHandler, identifier: &str, ) -> Option<AnyHandle<dyn Any>>
Load an asset with the given identifier.
Returns None if the asset could not be found or failed to serialize.
Implementations on Foreign Types§
Source§impl AssetLoader for Vec<Box<dyn AssetLoader>>
A Vec<Box> or similar structure can act as a combined loader over its elements,
querying them one by one. The boxed_vec! macro can help with this. Prefer this over the use of
a CombinedLoader.
impl AssetLoader for Vec<Box<dyn AssetLoader>>
A Vec<Boxboxed_vec! macro can help with this. Prefer this over the use of
a CombinedLoader.
fn load_asset( &self, handler: &mut dyn AssetCreationHandler, identifier: &str, ) -> Option<AnyHandle<dyn Any>>
Source§impl AssetLoader for HashMap<String, AnyHandle<dyn Any>>
A simple HashMap can act as a loader for a set of values in memory.
impl AssetLoader for HashMap<String, AnyHandle<dyn Any>>
A simple HashMap can act as a loader for a set of values in memory.
fn load_asset( &self, _handler: &mut dyn AssetCreationHandler, identifier: &str, ) -> Option<AnyHandle<dyn Any>>
Source§impl AssetLoader for PathBuf
A PathBuf can act as a loader for files relative to the directory it points to.
impl AssetLoader for PathBuf
A PathBuf can act as a loader for files relative to the directory it points to.
fn load_asset( &self, handler: &mut dyn AssetCreationHandler, identifier: &str, ) -> Option<AnyHandle<dyn Any>>
Implementors§
impl<Loader> AssetLoader for CachedLoader<Loader>where
Loader: AssetLoader,
Implement AssetLoader for the CachedLoader.