Struct amethyst_assets::AssetPtr [] [src]

pub struct AssetPtr<A, W> { /* fields omitted */ }

An AssetPtr which provides push_update, update and is_shared methods. These can simply be called in order to implement the Asset trait.

The recommended strategy is to create a struct for an asset which simply wraps AssetPtr and implements Asset by calling these methods. Methods for the asset can then be implemented on that wrapper struct by getting the inner asset with inner and inner_mut.

The type parameter A is the type of the asset handle (examples: texture handle, shader id, ..). To avoid unnecessarily duplicated buffer allocations, make sure your handle is reference-counted, so wrap it with an Arc in case the handle doesn't have this functionality itself.

Methods

impl<A, W> AssetPtr<A, W>
[src]

Creates a new asset pointer.

Take the inner asset.

Borrows the inner asset.

Borrows the inner asset mutably.

Returns true if a clone of this AssetPtr exists.

impl<A, W> AssetPtr<A, W> where
    A: Clone,
    W: AsRef<A> + Clone
[src]

Pushes an update to the shared update container; this update can then be applied to all asset pointers by calling update on them.

Applies a previously pushed update.

Trait Implementations

impl<A, W> Clone for AssetPtr<A, W> where
    A: Clone,
    W: Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<A, W> Debug for AssetPtr<A, W> where
    A: Debug
[src]

Formats the value using the given formatter.