Struct bevy_ecs::reflect::ReflectMapEntities
source · pub struct ReflectMapEntities { /* private fields */ }
Implementations§
source§impl ReflectMapEntities
impl ReflectMapEntities
sourcepub fn map_entities(
&self,
world: &mut World,
entity_map: &EntityMap
) -> Result<(), MapEntitiesError>
pub fn map_entities( &self, world: &mut World, entity_map: &EntityMap ) -> Result<(), MapEntitiesError>
A general method for applying MapEntities
behavior to all elements in an EntityMap
.
Be mindful in its usage: Works best in situations where the entities in the EntityMap
are newly
created, before systems have a chance to add new components. If some of the entities referred to
by the EntityMap
might already contain valid entity references, you should use map_entities
.
An example of this: A scene can be loaded with Parent
components, but then a Parent
component can be added
to these entities after they have been loaded. If you reload the scene using map_entities
, those Parent
components with already valid entity references could be updated to point at something else entirely.
sourcepub fn map_specific_entities(
&self,
world: &mut World,
entity_map: &EntityMap,
entities: &[Entity]
) -> Result<(), MapEntitiesError>
pub fn map_specific_entities( &self, world: &mut World, entity_map: &EntityMap, entities: &[Entity] ) -> Result<(), MapEntitiesError>
This is like map_entities
, but only applied to specific entities, not all values
in the EntityMap
.
This is useful mostly for when you need to be careful not to update components that already contain valid entity
values. See map_entities
for more details.
Trait Implementations§
source§impl Clone for ReflectMapEntities
impl Clone for ReflectMapEntities
source§fn clone(&self) -> ReflectMapEntities
fn clone(&self) -> ReflectMapEntities
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<C: Component + MapEntities> FromType<C> for ReflectMapEntities
impl<C: Component + MapEntities> FromType<C> for ReflectMapEntities
Auto Trait Implementations§
impl RefUnwindSafe for ReflectMapEntities
impl Send for ReflectMapEntities
impl Sync for ReflectMapEntities
impl Unpin for ReflectMapEntities
impl UnwindSafe for ReflectMapEntities
Blanket Implementations§
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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 + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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.