Struct warmy::Store
[−]
[src]
pub struct Store { /* fields omitted */ }
Resource store. Responsible for holding and presenting resources.
Methods
impl Store
[src]
fn new(opt: StoreOpt) -> Result<Self, StoreError>
[src]
Create a new store.
The root
represents the root directory from all the resources come from and is relative to
the binary’s location by default (unless you specify it as absolute).
fn root(&self) -> &Path
[src]
The canonicalized root the Store
is configured with.
fn get<T>(&mut self, key: &Key<T>) -> Result<Res<T>, StoreErrorOr<T>> where
T: Load,
T::Key: Clone + Hash,
[src]
T: Load,
T::Key: Clone + Hash,
Get a resource from the store and return an error if loading failed.
fn get_proxied<T, P>(
&mut self,
key: &Key<T>,
proxy: P
) -> Result<Res<T>, StoreError> where
T: Load,
T::Key: Clone + Hash,
P: FnOnce() -> T,
[src]
&mut self,
key: &Key<T>,
proxy: P
) -> Result<Res<T>, StoreError> where
T: Load,
T::Key: Clone + Hash,
P: FnOnce() -> T,
Get a resource from the store 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.
fn sync(&mut self)
[src]
Synchronize the store by updating the resources that ought to.