[][src]Struct warmy::load::Store

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

Resource store. Responsible for holding and presenting resources.

Methods

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

pub fn new(opt: StoreOpt<C, K>) -> Result<Self, StoreError<K>>[src]

Create a new store.

Failures

This function will fail if the root path in the StoreOpt doesn’t resolve to a correct canonicalized path.

pub fn sync(&mut self, ctx: &mut C) where
    K: for<'a> From<&'a Path>, 
[src]

Synchronize the Store by updating the resources that ought to with a provided context.

Methods from Deref<Target = Storage<C, K>>

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.

Trait Implementations

impl<C, K> DerefMut for Store<C, K>[src]

impl<C, K> Deref for Store<C, K>[src]

type Target = Storage<C, K>

The resulting type after dereferencing.

Auto Trait Implementations

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

impl<C, K> Unpin for Store<C, K> where
    K: Unpin

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

impl<C, K> !UnwindSafe for Store<C, K>

impl<C, K> !RefUnwindSafe for Store<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> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<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> Borrow<T> for T where
    T: ?Sized
[src]

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

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