Struct bevy::ecs::archetype::ArchetypeComponentId
source · pub struct ArchetypeComponentId(/* private fields */);
Expand description
An opaque unique joint ID for a Component
in an Archetype
within a World
.
A component may be present within multiple archetypes, but each component within
each archetype has its own unique ArchetypeComponentId
. This is leveraged by the system
schedulers to opportunistically run multiple systems in parallel that would otherwise
conflict. For example, Query<&mut A, With<B>>
and Query<&mut A, Without<B>>
can run in
parallel as the matched ArchetypeComponentId
sets for both queries are disjoint, even
though &mut A
on both queries point to the same ComponentId
.
In SQL terms, these IDs are composite keys on a many-to-many relationship between archetypes
and components. Each component type will have only one ComponentId
, but may have many
ArchetypeComponentId
s, one for every archetype the component is present in. Likewise, each
archetype will have only one ArchetypeId
but may have many ArchetypeComponentId
s, one
for each component that belongs to the archetype.
Every Resource
is also assigned one of these IDs. As resources do not belong to any
particular archetype, a resource’s ID uniquely identifies it.
These IDs are only valid within a given World, and are not globally unique. Attempting to use an ID on a world that it wasn’t sourced from will not point to the same archetype nor the same component.
Trait Implementations§
source§impl Clone for ArchetypeComponentId
impl Clone for ArchetypeComponentId
source§fn clone(&self) -> ArchetypeComponentId
fn clone(&self) -> ArchetypeComponentId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ArchetypeComponentId
impl Debug for ArchetypeComponentId
source§impl Hash for ArchetypeComponentId
impl Hash for ArchetypeComponentId
source§impl PartialEq for ArchetypeComponentId
impl PartialEq for ArchetypeComponentId
source§fn eq(&self, other: &ArchetypeComponentId) -> bool
fn eq(&self, other: &ArchetypeComponentId) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl SparseSetIndex for ArchetypeComponentId
impl SparseSetIndex for ArchetypeComponentId
source§fn sparse_set_index(&self) -> usize
fn sparse_set_index(&self) -> usize
source§fn get_sparse_set_index(value: usize) -> ArchetypeComponentId
fn get_sparse_set_index(value: usize) -> ArchetypeComponentId
impl Copy for ArchetypeComponentId
impl Eq for ArchetypeComponentId
impl StructuralEq for ArchetypeComponentId
impl StructuralPartialEq for ArchetypeComponentId
Auto Trait Implementations§
impl RefUnwindSafe for ArchetypeComponentId
impl Send for ArchetypeComponentId
impl Sync for ArchetypeComponentId
impl Unpin for ArchetypeComponentId
impl UnwindSafe for ArchetypeComponentId
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<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.