Struct bevy_ecs::entity::Entities [−][src]
pub struct Entities {
pub meta: Vec<EntityMeta>,
// some fields omitted
}
Fields
meta: Vec<EntityMeta>
Implementations
pub fn reserve_entities(&self, count: u32) -> ReserveEntitiesIterator<'_>ⓘNotable traits for ReserveEntitiesIterator<'a>impl<'a> Iterator for ReserveEntitiesIterator<'a> type Item = Entity;
pub fn reserve_entities(&self, count: u32) -> ReserveEntitiesIterator<'_>ⓘNotable traits for ReserveEntitiesIterator<'a>impl<'a> Iterator for ReserveEntitiesIterator<'a> type Item = Entity;
impl<'a> Iterator for ReserveEntitiesIterator<'a> type Item = Entity;
Reserve entity IDs concurrently.
Storage for entity generation and location is lazily allocated by calling flush
.
Reserve one entity ID concurrently.
Equivalent to self.reserve_entities(1).next().unwrap()
, but more efficient.
Allocate a specific entity ID, overwriting its generation.
Returns the location of the entity currently using the given ID, if any. Location should be written immediately.
Allocate a specific entity ID, overwriting its generation.
Returns the location of the entity currently using the given ID, if any.
Destroy an entity, allowing it to be reused.
Must not be called while reserved entities are awaiting flush()
.
Ensure at least n
allocations can succeed without reallocating.
Returns Ok(Location { archetype: Archetype::invalid(), index: undefined })
for pending entities.
Get the Entity
with a given id, if it exists in this Entities
collection
Returns None
if this Entity
is outside of the range of currently reserved Entities
Note: This method may return Entities
which are currently free
Note that contains
will correctly return false for freed
entities, since it checks the generation
Allocates space for entities previously reserved with reserve_entity
or
reserve_entities
, then initializes each one using the supplied function.
Safety
Flush must set the entity location to the correct ArchetypeId
for the given Entity
each time init is called. This can be ArchetypeId::INVALID
, provided the Entity
has not been assigned to an Archetype
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Entities
impl UnwindSafe for Entities
Blanket Implementations
Mutably borrows from an owned value. Read more
Convert 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
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Creates Self
using data from the given World
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more