Trait bones_framework::prelude::AssetIo
source · pub trait AssetIo: Sync + Send {
// Required methods
fn enumerate_packs(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send>>;
fn load_file(
&self,
loc: AssetLocRef<'_>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send>>;
// Provided method
fn watch(&self, change_sender: Sender<ChangedAsset>) -> bool { ... }
}
Expand description
AssetIo
is a trait that is implemented for backends capable of loading all the games assets
and returning the raw bytes stored in asset files.
Required Methods§
sourcefn enumerate_packs(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send>>
fn enumerate_packs( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send>>
List the names of the non-core asset pack folders that are installed.
These names, are not necessarily the names of the pack, but the names of the folders that
they are located in. These names can be used to load files from the pack in the
load_file()
method.
Provided Methods§
sourcefn watch(&self, change_sender: Sender<ChangedAsset>) -> bool
fn watch(&self, change_sender: Sender<ChangedAsset>) -> bool
Subscribe to asset changes.
Returns true
if this AssetIo
implementation supports watching for changes.