pub struct Entity { /* private fields */ }Expand description
A generational entity identifier used by the ECS.
§Fields
id: The slot index assigned by the allocator identifying this entity.generation: Monotonically increasing number preventing stale entity reuse.
§Safety
- Two entities are considered identical only if both
idandgenerationmatch. - When an entity is destroyed, its
generationis incremented. Holding an oldEntityvalue after destruction is safe: APIs validate the generation and will treat it as dead, preventing accidental access to a recycledid.
Trait Implementations§
impl Copy for Entity
impl Eq for Entity
impl StructuralPartialEq for Entity
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
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