pub struct Entities { /* private fields */ }Expand description
The entity allocator: slot generations, the free list, and the reservation counter.
Implementations§
Source§impl Entities
impl Entities
Sourcepub fn alloc(&mut self) -> Entity
pub fn alloc(&mut self) -> Entity
Allocate an entity, recycling a freed slot when one is available. The recycled slot keeps the generation it was bumped to at despawn, so old handles to it stay invalid.
Sourcepub fn reserve(&self) -> Entity
pub fn reserve(&self) -> Entity
Reserve a fresh entity id without taking &mut self. Lock-free, so it is
safe to call from worker threads while recording commands. Reserved ids
are always fresh (never recycled) and carry the first generation; call
flush under &mut self before looking them up.
Sourcepub fn flush(&mut self)
pub fn flush(&mut self)
Materialize any reserved-but-unmaterialized ids into the metadata table, marking them alive. Idempotent.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Entities
impl RefUnwindSafe for Entities
impl Send for Entities
impl Sync for Entities
impl Unpin for Entities
impl UnsafeUnpin for Entities
impl UnwindSafe for Entities
Blanket Implementations§
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
Mutably borrows from an owned value. Read more