pub struct EntityId(/* private fields */);Expand description
Lightweight identifier for an entity.
Entity identifiers are implemented using an index and a generation count. The generation count ensures that IDs from despawned entities are not reused by new entities.
An entity identifier is only meaningful in the World it was created
from. Attempting to use an entity ID in a different world will have
unexpected results.
Implementations§
Source§impl EntityId
impl EntityId
Sourcepub const NULL: Self
pub const NULL: Self
The entity ID which never identifies a live entity. This is the default
value for EntityId.
Sourcepub const fn new(index: u32, generation: u32) -> Option<Self>
pub const fn new(index: u32, generation: u32) -> Option<Self>
Creates a new entity ID from an index and generation count. Returns
None if a valid ID is not formed.
Sourcepub const fn generation(self) -> u32
pub const fn generation(self) -> u32
Returns the generation count of this ID.
Trait Implementations§
Source§impl Ord for EntityId
impl Ord for EntityId
Source§impl PartialOrd for EntityId
impl PartialOrd for EntityId
Source§impl Query for EntityId
Returns the EntityId of the matched entity.
impl Query for EntityId
Returns the EntityId of the matched entity.
Source§type Item<'a> = EntityId
type Item<'a> = EntityId
The item returned by this query. This is usually the same type as
Self, but with a modified lifetime.Source§fn init(
_world: &mut World,
_config: &mut HandlerConfig,
) -> Result<(ComponentAccess, Self::State), InitError>
fn init( _world: &mut World, _config: &mut HandlerConfig, ) -> Result<(ComponentAccess, Self::State), InitError>
Initialize the query. Returns an expression describing the components
accessed by the query and a new instance of
Self::State.Source§fn new_arch_state(
arch: &Archetype,
(): &mut Self::State,
) -> Option<Self::ArchState>
fn new_arch_state( arch: &Archetype, (): &mut Self::State, ) -> Option<Self::ArchState>
Returns a new
Self::ArchState instance.impl Copy for EntityId
impl Eq for EntityId
impl ReadOnlyQuery for EntityId
impl StructuralPartialEq for EntityId
Auto Trait Implementations§
impl Freeze for EntityId
impl RefUnwindSafe for EntityId
impl Send for EntityId
impl Sync for EntityId
impl Unpin for EntityId
impl UnwindSafe for EntityId
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
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§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
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more