Trait bevy::asset::ErasedAssetLoader
pub trait ErasedAssetLoader: Send + Sync + 'static {
// Required methods
fn load<'a>(
&'a self,
reader: &'a mut (dyn AsyncRead + Sync + Unpin + Send + '_),
meta: Box<dyn AssetMetaDyn, Global>,
load_context: LoadContext<'a>
) -> Pin<Box<dyn Future<Output = Result<ErasedLoadedAsset, Box<dyn Error + Sync + Send, Global>>> + Send + 'a, Global>>;
fn extensions(&self) -> &[&str];
fn deserialize_meta(
&self,
meta: &[u8]
) -> Result<Box<dyn AssetMetaDyn, Global>, DeserializeMetaError>;
fn default_meta(&self) -> Box<dyn AssetMetaDyn, Global>;
fn type_name(&self) -> &'static str;
fn type_id(&self) -> TypeId;
fn asset_type_name(&self) -> &'static str;
fn asset_type_id(&self) -> TypeId;
}
Expand description
Provides type-erased access to an AssetLoader
.
Required Methods§
fn load<'a>(
&'a self,
reader: &'a mut (dyn AsyncRead + Sync + Unpin + Send + '_),
meta: Box<dyn AssetMetaDyn, Global>,
load_context: LoadContext<'a>
) -> Pin<Box<dyn Future<Output = Result<ErasedLoadedAsset, Box<dyn Error + Sync + Send, Global>>> + Send + 'a, Global>>
fn load<'a>( &'a self, reader: &'a mut (dyn AsyncRead + Sync + Unpin + Send + '_), meta: Box<dyn AssetMetaDyn, Global>, load_context: LoadContext<'a> ) -> Pin<Box<dyn Future<Output = Result<ErasedLoadedAsset, Box<dyn Error + Sync + Send, Global>>> + Send + 'a, Global>>
Asynchronously loads the asset(s) 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.
fn deserialize_meta(
&self,
meta: &[u8]
) -> Result<Box<dyn AssetMetaDyn, Global>, DeserializeMetaError>
fn deserialize_meta( &self, meta: &[u8] ) -> Result<Box<dyn AssetMetaDyn, Global>, DeserializeMetaError>
Deserializes metadata from the input meta
bytes into the appropriate type (erased as Box<dyn AssetMetaDyn>
).
fn default_meta(&self) -> Box<dyn AssetMetaDyn, Global>
fn default_meta(&self) -> Box<dyn AssetMetaDyn, Global>
Returns the default meta value for the AssetLoader
(erased as Box<dyn AssetMetaDyn>
).
fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Returns the type name of the AssetLoader
.
fn type_id(&self) -> TypeId
fn type_id(&self) -> TypeId
Returns the TypeId
of the AssetLoader
.
fn asset_type_name(&self) -> &'static str
fn asset_type_name(&self) -> &'static str
Returns the type name of the top-level Asset
loaded by the AssetLoader
.
fn asset_type_id(&self) -> TypeId
fn asset_type_id(&self) -> TypeId
Returns the TypeId
of the top-level Asset
loaded by the AssetLoader
.