Trait distill_loader::handle::AssetHandle[][src]

pub trait AssetHandle {
    fn load_handle(&self) -> LoadHandle;

    fn load_status(&self, loader: &Loader) -> LoadStatus { ... }
fn asset<'a, T, S: TypedAssetStorage<T>>(
        &self,
        storage: &'a S
    ) -> Option<&'a T>
    where
        Self: Sized
, { ... }
fn asset_version<T, S: TypedAssetStorage<T>>(
        &self,
        storage: &S
    ) -> Option<u32>
    where
        Self: Sized
, { ... }
fn asset_with_version<'a, T, S: TypedAssetStorage<T>>(
        &self,
        storage: &'a S
    ) -> Option<(&'a T, u32)>
    where
        Self: Sized
, { ... }
fn downgrade(&self) -> WeakHandle { ... } }

The contract of an asset handle.

There are two types of asset handles:

  • Typed – Handle<T>: When the asset’s type is known when loading.
  • Generic – GenericHandle: When only the asset’s UUID is known when loading.

Required methods

fn load_handle(&self) -> LoadHandle[src]

Returns the LoadHandle of this asset handle.

Loading content...

Provided methods

fn load_status(&self, loader: &Loader) -> LoadStatus[src]

Returns the load status of the asset.

Parameters

  • loader: Loader that is loading the asset.

Type Parameters

  • L: Asset loader type.

fn asset<'a, T, S: TypedAssetStorage<T>>(&self, storage: &'a S) -> Option<&'a T> where
    Self: Sized
[src]

Returns an immutable reference to the asset if it is committed.

Parameters

  • storage: Asset storage.

fn asset_version<T, S: TypedAssetStorage<T>>(&self, storage: &S) -> Option<u32> where
    Self: Sized
[src]

Returns the version of the asset if it is committed.

Parameters

  • storage: Asset storage.

fn asset_with_version<'a, T, S: TypedAssetStorage<T>>(
    &self,
    storage: &'a S
) -> Option<(&'a T, u32)> where
    Self: Sized
[src]

Returns the asset with the given version if it is committed.

Parameters

  • storage: Asset storage.

fn downgrade(&self) -> WeakHandle[src]

Downgrades this handle into a WeakHandle.

Be aware that if there are no longer any strong handles to the asset, then the underlying asset may be freed at any time.

Loading content...

Implementors

Loading content...