Expand description
How a source path becomes a decoded asset.
AssetLoader is the extension point: a loader claims one or more file
extensions, declares which AssetKind it produces, and turns one
LoadContext into a LoadedAsset. AssetLoaders is the registry
the crate::AssetServer resolves through, and the built-in image and
SVG paths are ordinary loaders registered into it by
AssetLoaders::default.
The shape follows Bevy’s AssetLoader, adapted to how this crate loads:
- Loading is synchronous. A load runs on the decode worker pool, so a loader blocks its worker thread instead of awaiting.
- A load is described by a path plus, optionally, bytes an
crate::AssetSourcealready resolved. It is not a byte stream, because the built-in image path hands the path toimage::openrather than reading the file itself. - The loader is resolved on the main thread at enqueue time and travels with the job, so registering a loader never has to be synchronised with a running worker.
Structs§
- Asset
Loaders - Extension-keyed loader registry.
- Load
Context - Everything a loader is given for one load.
Enums§
- Asset
Kind - Which family of asset a loader produces.
- Loaded
Asset - One successfully loaded asset, tagged by family.
Traits§
- Asset
Loader - Turns one source path into a decoded asset.
Functions§
- asset_
extension - The lowercase extension used for loader lookup.