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: EntityId
pub const NULL: EntityId
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<EntityId>
pub const fn new(index: u32, generation: u32) -> Option<EntityId>
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, <EntityId as Query>::State), InitError>
fn init( _world: &mut World, _config: &mut HandlerConfig, ) -> Result<(ComponentAccess, <EntityId as Query>::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_state(_world: &mut World) -> <EntityId as Query>::State
fn new_state(_world: &mut World) -> <EntityId as Query>::State
Returns a new
Self::State
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.