pub struct Entity { /* private fields */ }Expand description
A live entity handle: a slot index plus the generation that slot carried when the handle was minted.
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn generation(self) -> u32
pub fn generation(self) -> u32
The generation the slot carried when this handle was minted.
Sourcepub fn to_bits(self) -> u64
pub fn to_bits(self) -> u64
Pack into a single u64 (index in the high half, generation in the low half). Stable representation for an FFI / scripting boundary.
Sourcepub fn from_bits(bits: u64) -> Option<Entity>
pub fn from_bits(bits: u64) -> Option<Entity>
Inverse of to_bits. Returns None when the generation half is zero,
which no live handle ever has, so a zeroed or truncated value is rejected
instead of forged into a valid-looking entity.
Sourcepub fn dangling() -> Entity
pub fn dangling() -> Entity
A handle the allocator never hands out (the top index is unreachable in practice). For a runtime-only component that has to name an Entity field but is never built from serialized args – its real value is inserted at runtime, so this placeholder is never observed by any system.
Trait Implementations§
impl Copy for Entity
impl Eq for Entity
Source§impl From<Entity> for EntityTarget
impl From<Entity> for EntityTarget
Source§impl Ord for Entity
impl Ord for Entity
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Entity
impl PartialOrd 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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.