pub trait AssetLoader:
Send
+ Sync
+ 'static {
// Required methods
fn extensions(&self) -> &[&str];
fn kind(&self) -> AssetKind;
fn load(&self, ctx: &LoadContext<'_>) -> Result<LoadedAsset, LoadErrorKind>;
}Expand description
Turns one source path into a decoded asset.
Implement it to teach the asset pipeline a format it does not know, then
register it with crate::AssetServer::register_loader (or
crate::register_asset_loader from a plugin’s build). Loaders run on
the decode worker pool, so an implementation must be Send + Sync and
should assume it is blocking a thread.
Required Methods§
Sourcefn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
File extensions this loader claims, lowercase and without the dot. Registering a loader claims every extension it names; a later registration wins over an earlier one for the same extension.
Sourcefn kind(&self) -> AssetKind
fn kind(&self) -> AssetKind
The family this loader produces. The object-safe stand-in for Bevy’s
associated type Asset.
Sourcefn load(&self, ctx: &LoadContext<'_>) -> Result<LoadedAsset, LoadErrorKind>
fn load(&self, ctx: &LoadContext<'_>) -> Result<LoadedAsset, LoadErrorKind>
Loads one asset. Returning Err caches the failure against the path
and attaches a failure component to every entity waiting on it.