Struct goods::LocalCache[][src]

pub struct LocalCache<K> { /* fields omitted */ }

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]

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]

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]

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]

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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.