Struct goods::LocalCache [−][src]
Asset cache. This type is main entry point for asset loading. Caches loaded assets and provokes loading work for new assets.
Implementations
impl<K> LocalCache<K>
[src]
pub fn new(registry: LocalRegistry<K>) -> Self
[src]
Creates new asset cache.
Assets will be loaded from provided registry
.
Loading tasks will be sent to Loader
.
pub fn load<A>(&self, key: K) -> LocalHandle<A>ⓘNotable traits for LocalHandle<A>
impl<A> Future for LocalHandle<A> where
A: Asset, type Output = Result<A>;
where
K: Key,
A: AssetDefaultFormat<K>,
A::DefaultFormat: LocalFormat<A::Repr, K>,
[src]
Notable traits for LocalHandle<A>
impl<A> Future for LocalHandle<A> where
A: Asset, type Output = Result<A>;
K: Key,
A: AssetDefaultFormat<K>,
A::DefaultFormat: LocalFormat<A::Repr, K>,
Requests an asset by the key
.
Returns cached asset handle if same asset type was loaded from same key
(even if loading is incomplete).
Uses default asset format for decoding.
pub fn load_with_format<A, F>(&self, key: K, format: F) -> LocalHandle<A>ⓘNotable traits for LocalHandle<A>
impl<A> Future for LocalHandle<A> where
A: Asset, type Output = Result<A>;
where
K: Key,
A: Asset,
F: LocalFormat<A::Repr, K>,
[src]
Notable traits for LocalHandle<A>
impl<A> Future for LocalHandle<A> where
A: Asset, type Output = Result<A>;
K: Key,
A: Asset,
F: LocalFormat<A::Repr, K>,
Requests an asset by the key
.
Returns cached asset handle if same asset type was loaded from same key
(even if loading is incomplete).
Uses provided asset format for decoding.
pub fn remove<A, Q>(&self, key: &Q) -> bool where
A: 'static,
K: Key + Borrow<Q>,
Q: Hash + Eq,
[src]
A: 'static,
K: Key + Borrow<Q>,
Q: Hash + Eq,
Removes asset cache with specified key if exists. Subsequent loads with that key will result in loading process started anew even if previously assets are still alive. Returns if asset cache was removed.
pub fn process<C: 'static>(&self, ctx: &mut C) where
K: 'static,
[src]
K: 'static,
Process intermediate asset represnetations into assets.
Calling this function will build all loaded assets whose context type is C
.
Trait Implementations
impl<K> Clone for LocalCache<K>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K> Debug for LocalCache<K>
[src]
Auto Trait Implementations
impl<K> !RefUnwindSafe for LocalCache<K>
[src]
impl<K> !Send for LocalCache<K>
[src]
impl<K> !Sync for LocalCache<K>
[src]
impl<K> Unpin for LocalCache<K>
[src]
impl<K> !UnwindSafe for LocalCache<K>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,