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§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) -> Self
fn get_sparse_set_index(value: usize) -> Self
impl Copy for ArchetypeComponentId
impl Eq for ArchetypeComponentId
impl StructuralPartialEq for ArchetypeComponentId
Auto Trait Implementations§
impl Freeze for ArchetypeComponentId
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> 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§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.