Struct amethyst_assets::Loader
[−]
[src]
pub struct Loader { /* fields omitted */ }
The asset loader, holding the contexts,
the default (directory) store and a reference to the
ThreadPool
.
Methods
impl Loader
[src]
fn new<P>(directory: P, pool: Arc<ThreadPool>) -> Self where
P: Into<PathBuf>,
P: Into<PathBuf>,
Creates a new asset loader, initializing the directory store with the given path.
fn add_store<I, S>(&mut self, name: I, store: S) where
I: Into<String>,
S: Store + Send + Sync + 'static,
I: Into<String>,
S: Store + Send + Sync + 'static,
Adds a store which can later be loaded from by supplying the same name
to load_from
.
fn register<A, C>(&mut self, context: C) where
A: Asset + 'static,
C: Context<Asset = A>,
A: Asset + 'static,
C: Context<Asset = A>,
Registers an asset and inserts a context into the map.
fn reload<A, F, N, S: ?Sized>(
&self,
name: N,
format: F,
store: &S
) -> AssetFuture<A> where
A: Asset,
F: Format + 'static,
F::Data: Into<<A::Context as Context>::Data>,
F::Error: 'static,
N: Into<String>,
S: Eq + Hash,
String: Borrow<S>,
&self,
name: N,
format: F,
store: &S
) -> AssetFuture<A> where
A: Asset,
F: Format + 'static,
F::Data: Into<<A::Context as Context>::Data>,
F::Error: 'static,
N: Into<String>,
S: Eq + Hash,
String: Borrow<S>,
Like load_from
, but doesn't ask the cache for the asset.
fn load<A, F, N>(&self, id: N, format: F) -> AssetFuture<A> where
A: Asset,
F: Format + 'static,
F::Data: Into<<A::Context as Context>::Data>,
N: Into<String>,
A: Asset,
F: Format + 'static,
F::Data: Into<<A::Context as Context>::Data>,
N: Into<String>,
Loads an asset with a given format from the default (directory) store.
If you want to load from a custom source instead, use load_from
.
The actual work is done on a worker thread, thus this method immediately returns a future.
fn load_from<A, F, N, S: ?Sized>(
&self,
name: N,
format: F,
store: &S
) -> AssetFuture<A> where
A: Asset,
F: Format + 'static,
F::Data: Into<<A::Context as Context>::Data>,
N: Into<String>,
S: AsRef<str> + Eq + Hash,
String: Borrow<S>,
&self,
name: N,
format: F,
store: &S
) -> AssetFuture<A> where
A: Asset,
F: Format + 'static,
F::Data: Into<<A::Context as Context>::Data>,
N: Into<String>,
S: AsRef<str> + Eq + Hash,
String: Borrow<S>,
Loads an asset with a given id and format from a custom store. The actual work is done on a worker thread, thus this method immediately returns a future.
Panics
Panics if the asset wasn't registered.