Struct hecs::Entity [−][src]
Lightweight unique ID, or handle, of an entity
Obtained from World::spawn
. Can be stored to refer to an entity in the future.
Enable the serde
feature on the crate to make this Serialize
able. Some applications may be
able to save space by only serializing the output of Entity::id
.
Implementations
impl Entity
[src]
pub fn to_bits(self) -> u64
[src]
Convert to a form convenient for passing outside of rust
No particular structure is guaranteed for the returned bits.
Useful for storing entity IDs externally, or in conjunction with Entity::from_bits
and
World::spawn_at
for easy serialization. Alternatively, consider id
for more compact
representation.
pub fn from_bits(bits: u64) -> Self
[src]
Reconstruct an Entity
previously destructured with to_bits
Useful for storing entity IDs externally, or in conjunction with Entity::to_bits
and
World::spawn_at
for easy serialization.
pub fn id(self) -> u32
[src]
Extract a transiently unique identifier
No two simultaneously-live entities share the same ID, but dead entities' IDs may collide with both live and dead entities. Useful for compactly representing entities within a specific snapshot of the world, such as when serializing.
See also World::find_entity_from_id
.
Trait Implementations
impl Clone for Entity
[src]
impl Copy for Entity
[src]
impl Debug for Entity
[src]
impl<'de> Deserialize<'de> for Entity
[src]
fn deserialize<D>(deserializer: D) -> Result<Entity, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Eq for Entity
[src]
impl Hash for Entity
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Entity
[src]
fn cmp(&self, other: &Entity) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Entity> for Entity
[src]
impl PartialOrd<Entity> for Entity
[src]
fn partial_cmp(&self, other: &Entity) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Entity
[src]
impl StructuralEq for Entity
[src]
impl StructuralPartialEq for Entity
[src]
Auto Trait Implementations
impl RefUnwindSafe for Entity
[src]
impl Send for Entity
[src]
impl Sync for Entity
[src]
impl Unpin for Entity
[src]
impl UnwindSafe for Entity
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,