[−][src]Struct warmy::load::Store
Resource store. Responsible for holding and presenting resources.
Methods
impl<C, K> Store<C, K> where
K: Key,
[src]
K: Key,
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]
K: for<'a> From<&'a Path>,
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]
&mut self,
key: &K,
ctx: &mut C
) -> Result<Res<T>, StoreErrorOr<T, C, K>> where
T: Load<C, K>,
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]
&mut self,
key: &K,
ctx: &mut C,
_: M
) -> Result<Res<T>, StoreErrorOr<T, C, K, M>> where
T: Load<C, K, M>,
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]
&mut self,
key: &K,
proxy: P,
ctx: &mut C
) -> Result<Res<T>, StoreError<K>> where
T: Load<C, K>,
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<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]
&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,
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> Deref for Store<C, K>
[src]
type Target = Storage<C, K>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<C, K> DerefMut for Store<C, K>
[src]
Auto Trait Implementations
impl<C, K> Unpin for Store<C, K> where
K: Unpin,
K: Unpin,
impl<C, K> !Sync for Store<C, K>
impl<C, K> !Send 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, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,