Trait distill_loader::storage::AssetStorage[][src]

pub trait AssetStorage {
    fn update_asset(
        &self,
        loader_info: &dyn LoaderInfoProvider,
        asset_type_id: &AssetTypeId,
        data: Vec<u8>,
        load_handle: LoadHandle,
        load_op: AssetLoadOp,
        version: u32
    ) -> Result<(), Box<dyn Error + Send + 'static>>;
fn commit_asset_version(
        &self,
        asset_type: &AssetTypeId,
        load_handle: LoadHandle,
        version: u32
    );
fn free(
        &self,
        asset_type_id: &AssetTypeId,
        load_handle: LoadHandle,
        version: u32
    ); }

Storage for all assets of all asset types.

Consumers are expected to provide the implementation for this, as this is the bridge between Loader and the application.

Required methods

fn update_asset(
    &self,
    loader_info: &dyn LoaderInfoProvider,
    asset_type_id: &AssetTypeId,
    data: Vec<u8>,
    load_handle: LoadHandle,
    load_op: AssetLoadOp,
    version: u32
) -> Result<(), Box<dyn Error + Send + 'static>>
[src]

Updates the backing data of an asset.

An example usage of this is when a texture such as “player.png” changes while the application is running. The asset ID is the same, but the underlying pixel data can differ.

Parameters

  • loader: Loader implementation calling this function.
  • asset_type_id: UUID of the asset type.
  • data: The updated asset byte data.
  • load_handle: ID allocated by Loader to track loading of a particular asset.
  • load_op: Allows the loading implementation to signal when loading is done / errors.
  • version: Runtime load version of this asset, increments each time the asset is updated.

fn commit_asset_version(
    &self,
    asset_type: &AssetTypeId,
    load_handle: LoadHandle,
    version: u32
)
[src]

Commits the specified asset version as loaded and ready to use.

Parameters

  • asset_type_id: UUID of the asset type.
  • load_handle: ID allocated by Loader to track loading of a particular asset.
  • version: Runtime load version of this asset, increments each time the asset is updated.

fn free(
    &self,
    asset_type_id: &AssetTypeId,
    load_handle: LoadHandle,
    version: u32
)
[src]

Frees the asset identified by the load handle.

Parameters

  • asset_type_id: UUID of the asset type.
  • load_handle: ID allocated by Loader to track loading of a particular asset.
Loading content...

Implementors

Loading content...