pub struct Entity { /* private fields */ }Expand description
Unique entity identifier with generation tracking
Each entity has:
id: Numeric identifier (can be reused after destruction)generation: Counter that increases when ID is reused
This prevents stale references: if you hold an old Entity handle, operations will fail safely because the generation won’t match.
§Example
ⓘ
let entity = world.spawn()
.insert(Position { x: 0.0, y: 0.0 })
.id();
println!("{}", entity); // "Entity(0v0)"Implementations§
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