Module assets_manager::source
source · Expand description
Bytes sources to load assets from.
This module contains the trait Source
, which allows to specify how the
files containing the assets are loaded. The main usage usage of this trait
is with an AssetCache
.
This module also contains three built-in sources: FileSystem
, Zip
and Embedded
.
§Hot-reloading
Hot-reloading enable assets to be reloaded automatically when the source it
was loaded from was modified. It requires the Source
to support it. The
built-in FileSystem
source supports it out of the box.
§Using a different source depending on the target platform
There is no file system on WebAssembly, so you can for example choose to embed your assets on this platform:
use assets_manager::{AssetCache, source};
#[cfg(not(target_arch = "wasm32"))]
let source = source::FileSystem::new("assets")?;
#[cfg(target_arch = "wasm32")]
let source = source::Embedded::from(source::embed!("assets"));
let cache = AssetCache::with_source(source);
Macros§
- embed
embedded
Embed a directory in the binary
Structs§
- Embedded
embedded
ASource
which is embedded in the binary. - A
Source
that contains nothing. - A
Source
to load assets from a directory in the file system. - RawEmbedded
embedded
The raw representation of embedded files. - Tar
tar
ASource
to load assets from a tar archive. - Zip
zip
ASource
to load assets from a zip archive.
Enums§
- An entry in a source.
- The raw content of a file.
- An owned version of a
DirEntry
Traits§
- Bytes sources to load assets from.