Struct amethyst_assets::AssetLoaderSystemData
source · pub struct AssetLoaderSystemData<'a, A>where
A: Asset,{ /* private fields */ }
Expand description
Helper type for loading assets
Implementations
sourceimpl<'a, A> AssetLoaderSystemData<'a, A>where
A: Asset,
impl<'a, A> AssetLoaderSystemData<'a, A>where
A: Asset,
sourcepub fn load<F, N, P>(
&self,
name: N,
format: F,
options: F::Options,
progress: P
) -> Handle<A>where
A: Asset,
F: Format<A>,
N: Into<String>,
P: Progress,
pub fn load<F, N, P>(
&self,
name: N,
format: F,
options: F::Options,
progress: P
) -> Handle<A>where
A: Asset,
F: Format<A>,
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.
sourcepub fn load_from<F, N, P, S>(
&self,
name: N,
format: F,
options: F::Options,
source: &S,
progress: P
) -> Handle<A>where
A: Asset,
F: Format<A> + 'static,
N: Into<String>,
P: Progress,
S: AsRef<str> + Eq + Hash + ?Sized,
String: Borrow<S>,
pub fn load_from<F, N, P, S>(
&self,
name: N,
format: F,
options: F::Options,
source: &S,
progress: P
) -> Handle<A>where
A: Asset,
F: Format<A> + 'static,
N: Into<String>,
P: Progress,
S: AsRef<str> + Eq + Hash + ?Sized,
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 themoptions
: Additional parameter toformat
to configure how exactly the data will be created. This could e.g. be mipmap levels for textures.source
: An identifier for a source which has previously been added usingwith_source
progress
: A tracker which will be notified of assets which have been imported
Trait Implementations
sourceimpl<'a, A> SystemData<'a> for AssetLoaderSystemData<'a, A>where
A: Asset,
ReadExpect<'a, Loader>: SystemData<'a>,
Read<'a, AssetStorage<A>>: SystemData<'a>,
impl<'a, A> SystemData<'a> for AssetLoaderSystemData<'a, A>where
A: Asset,
ReadExpect<'a, Loader>: SystemData<'a>,
Read<'a, AssetStorage<A>>: SystemData<'a>,
sourcefn fetch(res: &'a Resources) -> Self
fn fetch(res: &'a Resources) -> Self
Fetches the system data from
Resources
. Note that this is only specified for one concrete
lifetime 'a
, you need to implement the SystemData
trait for every possible
lifetime. Read moreAuto Trait Implementations
impl<'a, A> !RefUnwindSafe for AssetLoaderSystemData<'a, A>
impl<'a, A> Send for AssetLoaderSystemData<'a, A>
impl<'a, A> Sync for AssetLoaderSystemData<'a, A>
impl<'a, A> Unpin for AssetLoaderSystemData<'a, A>
impl<'a, A> !UnwindSafe for AssetLoaderSystemData<'a, A>
Blanket Implementations
impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<'a, T> DynamicSystemData<'a> for Twhere
T: SystemData<'a>,
impl<'a, T> DynamicSystemData<'a> for Twhere
T: SystemData<'a>,
type Accessor = StaticAccessor<T>
type Accessor = StaticAccessor<T>
The accessor of the
SystemData
, which specifies the read and write dependencies and does
the fetching. Read moresourcefn setup(_: &StaticAccessor<T>, res: &mut Resources)
fn setup(_: &StaticAccessor<T>, res: &mut Resources)
Sets up
Resources
for fetching this system data.impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.