Struct warmy::load::Store
[−]
[src]
pub struct Store<C> { /* fields omitted */ }
Resource store. Responsible for holding and presenting resources.
Methods
impl<C> Store<C>
[src]
pub fn new(opt: StoreOpt) -> Result<Self, StoreError>
[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)
[src]
Synchronize the Store
by updating the resources that ought to with a provided context.
Methods from Deref<Target = Storage<C>>
pub fn root(&self) -> &Path
[src]
The canonicalized root the Storage
is configured with.
pub fn get<K, T>(
&mut self,
key: &K,
ctx: &mut C
) -> Result<Res<T>, StoreErrorOr<T, C>> where
T: Load<C>,
K: Clone + Into<T::Key>,
[src]
&mut self,
key: &K,
ctx: &mut C
) -> Result<Res<T>, StoreErrorOr<T, C>> where
T: Load<C>,
K: Clone + Into<T::Key>,
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<K, T, M>(
&mut self,
key: &K,
ctx: &mut C,
_: M
) -> Result<Res<T>, StoreErrorOr<T, C, M>> where
T: Load<C, M>,
K: Clone + Into<T::Key>,
[src]
&mut self,
key: &K,
ctx: &mut C,
_: M
) -> Result<Res<T>, StoreErrorOr<T, C, M>> where
T: Load<C, M>,
K: Clone + Into<T::Key>,
Get a resource from the Storage
by using a specific method and return and error if its
loading failed.
pub fn get_proxied<K, T, P>(
&mut self,
key: &K,
proxy: P,
ctx: &mut C
) -> Result<Res<T>, StoreError> where
T: Load<C>,
K: Clone + Into<T::Key>,
P: FnOnce() -> T,
[src]
&mut self,
key: &K,
proxy: P,
ctx: &mut C
) -> Result<Res<T>, StoreError> where
T: Load<C>,
K: Clone + Into<T::Key>,
P: FnOnce() -> T,
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<K, T, M, P>(
&mut self,
key: &K,
proxy: P,
ctx: &mut C,
method: M
) -> Result<Res<T>, StoreError> where
T: Load<C, M>,
K: Clone + Into<T::Key>,
P: FnOnce() -> T,
[src]
&mut self,
key: &K,
proxy: P,
ctx: &mut C,
method: M
) -> Result<Res<T>, StoreError> where
T: Load<C, M>,
K: Clone + Into<T::Key>,
P: FnOnce() -> T,
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> Deref for Store<C>
[src]
type Target = Storage<C>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Dereferences the value.