[−][src]Struct amethyst_assets::Loader
The asset loader, holding the sources and a reference to the ThreadPool
.
Methods
impl Loader
[src]
pub fn new<P>(directory: P, pool: Arc<ThreadPool>) -> Self where
P: Into<PathBuf>,
[src]
P: Into<PathBuf>,
Creates a new asset loader, initializing the directory store with the given path.
pub fn with_default_source<S>(source: S, pool: Arc<ThreadPool>) -> Self where
S: Source,
[src]
S: Source,
Creates a new asset loader, using the provided source
pub fn add_source<I, S>(&mut self, id: I, source: S) where
I: Into<String>,
S: Source,
[src]
I: Into<String>,
S: Source,
Add a source to the Loader
, given an id and the source.
pub fn set_default_source<S>(&mut self, source: S) where
S: Source,
[src]
S: Source,
Set the default source of the Loader
.
pub fn set_hot_reload(&mut self, value: bool)
[src]
If set to true
, this Loader
will ask formats to
generate "reload instructions" which allow reloading.
Calling set_hot_reload(true)
does not actually enable
hot reloading; this is controlled by the HotReloadStrategy
resource.
pub fn load<A, F, N, P>(
&self,
name: N,
format: F,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
F: Format<A::Data>,
N: Into<String>,
P: Progress,
[src]
&self,
name: N,
format: F,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
F: Format<A::Data>,
N: Into<String>,
P: Progress,
Loads an asset with a given format from the default (directory) source.
If you want to load from a custom source instead, use load_from
.
See load_from
for more information.
pub fn load_from<A, F, N, P, S: ?Sized>(
&self,
name: N,
format: F,
source: &S,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
F: Format<A::Data>,
N: Into<String>,
P: Progress,
S: AsRef<str> + Eq + Hash,
String: Borrow<S>,
[src]
&self,
name: N,
format: F,
source: &S,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
F: Format<A::Data>,
N: Into<String>,
P: Progress,
S: AsRef<str> + Eq + Hash,
String: Borrow<S>,
Loads an asset with a given id and format from a custom source. The actual work is done in a worker thread, thus this method immediately returns a handle.
Parameters
name
: this is just an identifier for the asset, most likely a file name e.g."meshes/a.obj"
format
: A format struct which loads bytes from asource
and producesAsset::Data
with themsource
: An identifier for a source which has previously been added usingwith_source
progress
: A tracker which will be notified of assets which have been importedstorage
: The asset storage which can be fetched from the ECSWorld
usingread_resource
.
pub fn load_from_data<A, P>(
&self,
data: A::Data,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
P: Progress,
[src]
&self,
data: A::Data,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
P: Progress,
Load an asset from data and return a handle.
pub fn load_from_data_async<A, P, F>(
&self,
data: F,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
P: Progress,
F: FnOnce() -> A::Data + Send + Sync + 'static,
[src]
&self,
data: F,
progress: P,
storage: &AssetStorage<A>
) -> Handle<A> where
A: Asset,
P: Progress,
F: FnOnce() -> A::Data + Send + Sync + 'static,
Asynchronously load an asset from data and return a handle.
Auto Trait Implementations
impl Unpin for Loader
impl Sync for Loader
impl Send for Loader
impl !UnwindSafe for Loader
impl !RefUnwindSafe for Loader
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Any for T where
T: Any,
[src]
T: Any,
fn get_type_id(&self) -> TypeId
[src]
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,