[][src]Struct warmy::load::Storage

pub struct Storage<C, K> { /* fields omitted */ }

Resource storage.

This type is responsible for storing resources, giving functions to look them up and update them whenever needed.

Methods

impl<C, K> Storage<C, K> where
    K: Key
[src]

pub fn root(&self) -> &Path[src]

The canonicalized root the Storage is configured with.

pub fn get<T>(
    &mut self,
    key: &K,
    ctx: &mut C
) -> Result<Res<T>, StoreErrorOr<T, C, K>> where
    T: Load<C, K>, 
[src]

Get a resource from the Storage and return an error if its loading failed.

This function uses the default loading method.

pub fn get_by<T, M>(
    &mut self,
    key: &K,
    ctx: &mut C,
    _: M
) -> Result<Res<T>, StoreErrorOr<T, C, K, M>> where
    T: Load<C, K, M>, 
[src]

Get a resource from the Storage by using a specific method and return and error if its loading failed.

pub fn get_proxied<T, P>(
    &mut self,
    key: &K,
    proxy: P,
    ctx: &mut C
) -> Result<Res<T>, StoreError<K>> where
    T: Load<C, K>,
    P: FnOnce() -> T, 
[src]

Get a resource from the Storage for the given key. If it fails, a proxied version is used, which will get replaced by the resource once it’s available and reloaded.

This function uses the default loading method.

pub fn get_proxied_by<T, M, P>(
    &mut self,
    key: &K,
    proxy: P,
    ctx: &mut C,
    method: M
) -> Result<Res<T>, StoreError<K>> where
    T: Load<C, K, M>,
    P: FnOnce() -> T, 
[src]

Get a resource from the Storage for the given key by using a specific method. If it fails, a proxied version is used, which will get replaced by the resource once it’s available and reloaded.

Auto Trait Implementations

impl<C, K> !Send for Storage<C, K>

impl<C, K> !Sync for Storage<C, K>

Blanket Implementations

impl<'a, T, C, M> Inspect<'a, C, (), M> for T[src]

impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T[src]

impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T[src]

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

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

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]