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]
fn new(data: A) -> Self
Creates a new asset pointer.
fn inner(self) -> A
Take the inner asset.
fn inner_ref(&self) -> &A
Borrows the inner asset.
fn inner_mut(&mut self) -> &mut A
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]
A: Clone,
W: AsRef<A> + Clone,
fn push_update(&self, updated: AssetFuture<W>)
Pushes an update to the shared update container;
this update can then be applied to all asset pointers by calling
update
on them.
fn update(&mut self)
Applies a previously pushed update.
Trait Implementations
impl<A, W> Clone for AssetPtr<A, W> where
A: Clone,
W: Clone,
[src]
A: Clone,
W: Clone,
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<A, W> Debug for AssetPtr<A, W> where
A: Debug,
[src]
A: Debug,