pub struct ArchetypeId(/* private fields */);
Expand description
An opaque unique ID for a single Archetype
within a World
.
Archetype IDs are only valid for a given World, and are not globally unique.
Attempting to use an archetype ID on a world that it wasn’t sourced from will
not return the archetype with the same components. The only exception to this is
EMPTY
which is guaranteed to be identical for all Worlds.
Implementations§
Source§impl ArchetypeId
impl ArchetypeId
Sourcepub const EMPTY: ArchetypeId = _
pub const EMPTY: ArchetypeId = _
The ID for the Archetype
without any components.
Sourcepub const INVALID: ArchetypeId = _
pub const INVALID: ArchetypeId = _
§Safety:
This must always have an all-1s bit pattern to ensure soundness in fast entity id space allocation.
Sourcepub const fn new(index: usize) -> Self
pub const fn new(index: usize) -> Self
Create an ArchetypeId
from a plain value.
This is useful if you need to store the ArchetypeId
as a plain value,
for example in a specialized data structure such as a bitset.
While it doesn’t break any safety invariants, you should ensure the
values comes from a pre-existing ArchetypeId::index
in this world
to avoid panics and other unexpected behaviors.
Sourcepub fn index(self) -> usize
pub fn index(self) -> usize
The plain value of this ArchetypeId
.
In bevy, this is mostly used to store archetype ids in FixedBitSet
s.
Trait Implementations§
Source§impl Clone for ArchetypeId
impl Clone for ArchetypeId
Source§fn clone(&self) -> ArchetypeId
fn clone(&self) -> ArchetypeId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ArchetypeId
impl Debug for ArchetypeId
Source§impl Hash for ArchetypeId
impl Hash for ArchetypeId
Source§impl Index<ArchetypeId> for Archetypes
impl Index<ArchetypeId> for Archetypes
Source§impl IndexMut<ArchetypeId> for Archetypes
impl IndexMut<ArchetypeId> for Archetypes
Source§impl Ord for ArchetypeId
impl Ord for ArchetypeId
Source§fn cmp(&self, other: &ArchetypeId) -> Ordering
fn cmp(&self, other: &ArchetypeId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ArchetypeId
impl PartialEq for ArchetypeId
Source§impl PartialOrd for ArchetypeId
impl PartialOrd for ArchetypeId
impl Copy for ArchetypeId
impl Eq for ArchetypeId
impl StructuralPartialEq for ArchetypeId
Auto Trait Implementations§
impl Freeze for ArchetypeId
impl RefUnwindSafe for ArchetypeId
impl Send for ArchetypeId
impl Sync for ArchetypeId
impl Unpin for ArchetypeId
impl UnwindSafe for ArchetypeId
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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§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.