Skip to main content

TypedAssetStorage

Trait TypedAssetStorage 

Source
pub trait TypedAssetStorage<A> {
    // Required methods
    fn get<T: AssetHandle>(&self, handle: &T) -> Option<&A>;
    fn get_version<T: AssetHandle>(&self, handle: &T) -> Option<u32>;
    fn get_asset_with_version<T: AssetHandle>(
        &self,
        handle: &T,
    ) -> Option<(&A, u32)>;
}
Expand description

Implementors of crate::storage::AssetStorage can implement this trait to enable convenience functions on the common AssetHandle trait, which is implemented by all handle types.

Required Methods§

Source

fn get<T: AssetHandle>(&self, handle: &T) -> Option<&A>

Returns the asset for the given handle, or None if has not completed loading.

§Parameters
  • handle: Handle of the asset.
§Type Parameters
  • T: Asset handle type.
Source

fn get_version<T: AssetHandle>(&self, handle: &T) -> Option<u32>

Returns the version of a loaded asset, or None if has not completed loading.

§Parameters
  • handle: Handle of the asset.
§Type Parameters
  • T: Asset handle type.
Source

fn get_asset_with_version<T: AssetHandle>( &self, handle: &T, ) -> Option<(&A, u32)>

Returns the loaded asset and its version, or None if has not completed loading.

§Parameters
  • handle: Handle of the asset.
§Type Parameters
  • T: Asset handle type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§