Struct amethyst_assets::PrefabLoader
source · Expand description
Helper structure for loading prefabs.
The recommended way of using this from State
s is to use world.exec
.
Example
ⓘ
let prefab_handle = world.exec(|loader: PrefabLoader<SomePrefab>| {
loader.load("prefab.ron", RonFormat, (), ()
});
Implementations
Trait Implementations
sourceimpl<'a, T> SystemData<'a> for PrefabLoader<'a, T>where
T: Send + Sync + 'static,
ReadExpect<'a, Loader>: SystemData<'a>,
Read<'a, AssetStorage<Prefab<T>>>: SystemData<'a>,
impl<'a, T> SystemData<'a> for PrefabLoader<'a, T>where
T: Send + Sync + 'static,
ReadExpect<'a, Loader>: SystemData<'a>,
Read<'a, AssetStorage<Prefab<T>>>: 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, T> !RefUnwindSafe for PrefabLoader<'a, T>
impl<'a, T> Send for PrefabLoader<'a, T>
impl<'a, T> Sync for PrefabLoader<'a, T>
impl<'a, T> Unpin for PrefabLoader<'a, T>
impl<'a, T> !UnwindSafe for PrefabLoader<'a, T>
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.