Struct bevy_internal::ecs::archetype::ArchetypeId
source · 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) -> ArchetypeId
pub const fn new(index: usize) -> ArchetypeId
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§fn index(
&self,
index: ArchetypeId
) -> &<Archetypes as Index<ArchetypeId>>::Output
fn index( &self, index: ArchetypeId ) -> &<Archetypes as Index<ArchetypeId>>::Output
container[index]
) operation. Read moresource§impl IndexMut<ArchetypeId> for Archetypes
impl IndexMut<ArchetypeId> for Archetypes
source§fn index_mut(
&mut self,
index: ArchetypeId
) -> &mut <Archetypes as Index<ArchetypeId>>::Output
fn index_mut( &mut self, index: ArchetypeId ) -> &mut <Archetypes as Index<ArchetypeId>>::Output
container[index]
) operation. Read moresource§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§fn eq(&self, other: &ArchetypeId) -> bool
fn eq(&self, other: &ArchetypeId) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ArchetypeId
impl PartialOrd for ArchetypeId
source§fn partial_cmp(&self, other: &ArchetypeId) -> Option<Ordering>
fn partial_cmp(&self, other: &ArchetypeId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for ArchetypeId
impl Eq for ArchetypeId
impl StructuralEq for ArchetypeId
impl StructuralPartialEq for ArchetypeId
Auto Trait Implementations§
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, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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<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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.