Struct bevy_render::Extract
source · pub struct Extract<'w, 's, P>where
P: ReadOnlySystemParam + 'static,{ /* private fields */ }
Expand description
A helper for accessing MainWorld
content using a system parameter.
A SystemParam
adapter which applies the contained SystemParam
to the World
contained in MainWorld
. This parameter only works for systems run
during the ExtractSchedule
.
This requires that the contained SystemParam
does not mutate the world, as it
uses a read-only reference to MainWorld
internally.
Context
ExtractSchedule
is used to extract (move) data from the simulation world (MainWorld
) to the
render world. The render world drives rendering each frame (generally to a Window
).
This design is used to allow performing calculations related to rendering a prior frame at the same
time as the next frame is simulated, which increases throughput (FPS).
Extract
is used to get data from the main world during ExtractSchedule
.
Examples
use bevy_ecs::prelude::*;
use bevy_render::Extract;
fn extract_clouds(mut commands: Commands, clouds: Extract<Query<Entity, With<Cloud>>>) {
for cloud in &clouds {
commands.get_or_spawn(cloud).insert(Cloud);
}
}
Trait Implementations§
source§impl<'w, 's, P> Deref for Extract<'w, 's, P>where
P: ReadOnlySystemParam,
impl<'w, 's, P> Deref for Extract<'w, 's, P>where
P: ReadOnlySystemParam,
source§impl<'w, 's, P> DerefMut for Extract<'w, 's, P>where
P: ReadOnlySystemParam,
impl<'w, 's, P> DerefMut for Extract<'w, 's, P>where
P: ReadOnlySystemParam,
source§impl<'a, 'w, 's, P> IntoIterator for &'a Extract<'w, 's, P>
impl<'a, 'w, 's, P> IntoIterator for &'a Extract<'w, 's, P>
§type Item = <&'a <P as SystemParam>::Item<'w, 's> as IntoIterator>::Item
type Item = <&'a <P as SystemParam>::Item<'w, 's> as IntoIterator>::Item
§type IntoIter = <&'a <P as SystemParam>::Item<'w, 's> as IntoIterator>::IntoIter
type IntoIter = <&'a <P as SystemParam>::Item<'w, 's> as IntoIterator>::IntoIter
source§impl<P> SystemParam for Extract<'_, '_, P>where
P: ReadOnlySystemParam,
impl<P> SystemParam for Extract<'_, '_, P>where
P: ReadOnlySystemParam,
§type Item<'w, 's> = Extract<'w, 's, P>
type Item<'w, 's> = Extract<'w, 's, P>
Self
, instantiated with new lifetimes. Read moresource§fn init_state(world: &mut World, system_meta: &mut SystemMeta) -> Self::State
fn init_state(world: &mut World, system_meta: &mut SystemMeta) -> Self::State
World
access used by this SystemParam
and creates a new instance of this param’s State
.source§unsafe fn get_param<'w, 's>(
state: &'s mut Self::State,
system_meta: &SystemMeta,
world: UnsafeWorldCell<'w>,
change_tick: Tick
) -> Self::Item<'w, 's>
unsafe fn get_param<'w, 's>( state: &'s mut Self::State, system_meta: &SystemMeta, world: UnsafeWorldCell<'w>, change_tick: Tick ) -> Self::Item<'w, 's>
SystemParamFunction
. Read moresource§fn new_archetype(
_state: &mut Self::State,
_archetype: &Archetype,
_system_meta: &mut SystemMeta
)
fn new_archetype( _state: &mut Self::State, _archetype: &Archetype, _system_meta: &mut SystemMeta )
Archetype
, registers the components accessed by this SystemParam
(if applicable).source§fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
SystemParam
’s state.
This is used to apply Commands
during apply_deferred
.impl<P> ReadOnlySystemParam for Extract<'_, '_, P>where
P: ReadOnlySystemParam,
Auto Trait Implementations§
impl<'w, 's, P> RefUnwindSafe for Extract<'w, 's, P>
impl<'w, 's, P> Send for Extract<'w, 's, P>
impl<'w, 's, P> Sync for Extract<'w, 's, P>
impl<'w, 's, P> Unpin for Extract<'w, 's, P>
impl<'w, 's, P> UnwindSafe for Extract<'w, 's, P>
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.