Trait ambient_asset_cache::AsyncAssetKey
source · pub trait AsyncAssetKey<T: Asset + Clone + Sync + Send + 'static>: Sync + Send + Debug {
// Required method
fn load<'async_trait>(
self,
assets: AssetCache
) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided methods
fn in_background(self) -> BackgroundKey<Self>
where Self: Sized { ... }
fn keepalive(&self) -> AssetKeepalive { ... }
fn drop_policy(&self) -> AssetLoadDropPolicy { ... }
fn cpu_size(&self, _asset: &T) -> Option<u64> { ... }
fn gpu_size(&self, _asset: &T) -> Option<u64> { ... }
}
Required Methods§
fn load<'async_trait>( self, assets: AssetCache ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>where Self: 'async_trait,
Provided Methods§
sourcefn in_background(self) -> BackgroundKey<Self>where
Self: Sized,
fn in_background(self) -> BackgroundKey<Self>where Self: Sized,
Adapter to make the key load in a background task.
This allows get
and load
to work outside the tokio runtime.
It also prevents the loading from being aborted