Struct amethyst_assets::Cache
[−]
[src]
pub struct Cache<A> { /* fields omitted */ }
A simple cache for asset handles of type A
.
This stores WeakHandle
, so it doesn't keep the assets alive.
Methods
impl<A> Cache<A> where
A: Clone,
[src]
A: Clone,
pub fn new() -> Self
[src]
Creates a new Cache
and initializes it with the default values.
pub fn insert<K: Into<String>>(
&mut self,
key: K,
asset: &Handle<A>
) -> Option<WeakHandle<A>>
[src]
&mut self,
key: K,
asset: &Handle<A>
) -> Option<WeakHandle<A>>
Inserts an asset with a given key
and returns the old value (if any).
pub fn get<K: ?Sized>(&self, key: &K) -> Option<Handle<A>> where
K: Hash + Eq,
String: Borrow<K>,
[src]
K: Hash + Eq,
String: Borrow<K>,
Retrieves an asset handle using a given key
.
pub fn clear_dead<F>(&mut self)
[src]
Deletes all cached handles which are invalid.
pub fn clear_all(&mut self)
[src]
Clears all values.