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 sync(&mut self)
[src]
Synchronize the Store
by updating the resources that ought to.
Methods from Deref<Target = Storage>
fn root(&self) -> &Path
[src]
The canonicalized root the Storage
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 Storage
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 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.
Trait Implementations
impl Deref for Store
[src]
type Target = Storage
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Dereferences the value.