pub trait DirectAssetAccessExt {
// Required methods
fn add_asset<A>(&mut self, asset: impl Into<A>) -> Handle<A>
where A: Asset;
fn load_asset<'a, A>(&self, path: impl Into<AssetPath<'a>>) -> Handle<A>
where A: Asset;
fn load_builder(&self) -> LoadBuilder<'_>;
fn load_asset_with_settings<'a, A, S>(
&self,
path: impl Into<AssetPath<'a>>,
settings: impl Fn(&mut S) + Send + Sync + 'static,
) -> Handle<A>
where A: Asset,
S: Settings;
}Expand description
An extension trait for methods for working with assets directly from a World.
Required Methods§
Sourcefn add_asset<A>(&mut self, asset: impl Into<A>) -> Handle<A>where
A: Asset,
fn add_asset<A>(&mut self, asset: impl Into<A>) -> Handle<A>where
A: Asset,
Insert an asset similarly to Assets::add.
Sourcefn load_asset<'a, A>(&self, path: impl Into<AssetPath<'a>>) -> Handle<A>where
A: Asset,
fn load_asset<'a, A>(&self, path: impl Into<AssetPath<'a>>) -> Handle<A>where
A: Asset,
Load an asset similarly to AssetServer::load.
Sourcefn load_builder(&self) -> LoadBuilder<'_>
fn load_builder(&self) -> LoadBuilder<'_>
Creates a new LoadBuilder similar to AssetServer::load_builder.
Sourcefn load_asset_with_settings<'a, A, S>(
&self,
path: impl Into<AssetPath<'a>>,
settings: impl Fn(&mut S) + Send + Sync + 'static,
) -> Handle<A>
👎Deprecated: Use world.load_builder().with_settings(settings).load(path)
fn load_asset_with_settings<'a, A, S>( &self, path: impl Into<AssetPath<'a>>, settings: impl Fn(&mut S) + Send + Sync + 'static, ) -> Handle<A>
Use world.load_builder().with_settings(settings).load(path)
Load an asset with settings, similarly to AssetServer::load_with_settings.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".