Trait warmy::Load
[−]
[src]
pub trait Load: 'static + Sized { type Error: Error; fn from_fs<P>(
path: P,
store: &mut Store
) -> Result<Loaded<Self>, Self::Error>
where
P: AsRef<Path>; fn reload<P>(
_: &Self,
path: P,
store: &mut Store
) -> Result<Self, Self::Error>
where
P: AsRef<Path>, { ... } }
Loadable object from disk.
An object can be loaded from disk if, given a path, it can output a Loaded<_>
. It’s
important to note that you’re not supposed to use that trait directly. Instead, you should use
the Store
’s functions.
Associated Types
Required Methods
fn from_fs<P>(path: P, store: &mut Store) -> Result<Loaded<Self>, Self::Error> where
P: AsRef<Path>,
P: AsRef<Path>,
Load a resource from the file system. The Store
can be used to load or declare additional
resource dependencies. The result type is used to register for dependency events.
Provided Methods
fn reload<P>(_: &Self, path: P, store: &mut Store) -> Result<Self, Self::Error> where
P: AsRef<Path>,
P: AsRef<Path>,
Function called when a resource must be reloaded.
The default implementation of that function calls from_fs
and returns its result.