Trait bevy::asset::AssetLoader
pub trait AssetLoader: Send + Sync + 'static {
type Asset: Asset;
type Settings: Settings + Default + Serialize + for<'a> Deserialize<'a>;
type Error: Into<Box<dyn Error + Sync + Send, Global>>;
// Required methods
fn load<'a>(
&'a self,
reader: &'a mut (dyn AsyncRead + Sync + Unpin + Send + '_),
settings: &'a Self::Settings,
load_context: &'a mut LoadContext<'_>
) -> Pin<Box<dyn Future<Output = Result<Self::Asset, Self::Error>> + Send + 'a, Global>>;
fn extensions(&self) -> &[&str];
}
Expand description
Loads an Asset
from a given byte Reader
. This can accept AssetLoader::Settings
, which configure how the Asset
should be loaded.
Required Associated Types§
type Asset: Asset
type Asset: Asset
The top level Asset
loaded by this AssetLoader
.
type Settings: Settings + Default + Serialize + for<'a> Deserialize<'a>
type Settings: Settings + Default + Serialize + for<'a> Deserialize<'a>
The settings type used by this AssetLoader
.
Required Methods§
fn load<'a>(
&'a self,
reader: &'a mut (dyn AsyncRead + Sync + Unpin + Send + '_),
settings: &'a Self::Settings,
load_context: &'a mut LoadContext<'_>
) -> Pin<Box<dyn Future<Output = Result<Self::Asset, Self::Error>> + Send + 'a, Global>>
fn load<'a>( &'a self, reader: &'a mut (dyn AsyncRead + Sync + Unpin + Send + '_), settings: &'a Self::Settings, load_context: &'a mut LoadContext<'_> ) -> Pin<Box<dyn Future<Output = Result<Self::Asset, Self::Error>> + Send + 'a, Global>>
Asynchronously loads AssetLoader::Asset
(and any other labeled assets) from the bytes provided by Reader
.
fn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
Returns a list of extensions supported by this asset loader, without the preceding dot.
Implementations on Foreign Types§
§impl AssetLoader for ()
impl AssetLoader for ()
The () loader should never be called. This implementation exists to make the meta format nicer to work with.