Struct bevy_ecs::component::ComponentId
source · pub struct ComponentId(_);
Expand description
A semi-opaque value which uniquely identifies the type of a Component
within a
World
.
Each time a new Component
type is registered within a World
using
World::init_component
or
World::init_component_with_descriptor
,
a corresponding ComponentId
is created to track it.
While the distinction between ComponentId
and TypeId
may seem superficial, breaking them
into two separate but related concepts allows components to exist outside of Rust’s type system.
Each Rust type registered as a Component
will have a corresponding ComponentId
, but additional
ComponentId
s may exist in a World
to track components which cannot be
represented as Rust types for scripting or other advanced use-cases.
A ComponentId
is tightly coupled to its parent World
. Attempting to use a ComponentId
from
one World
to access the metadata of a Component
in a different World
is undefined behaviour
and must not be attempted.
Implementations§
source§impl ComponentId
impl ComponentId
Trait Implementations§
source§impl Clone for ComponentId
impl Clone for ComponentId
source§fn clone(&self) -> ComponentId
fn clone(&self) -> ComponentId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ComponentId
impl Debug for ComponentId
source§impl<T: Component> From<ComponentIdFor<T>> for ComponentId
impl<T: Component> From<ComponentIdFor<T>> for ComponentId
source§fn from(to_component_id: ComponentIdFor<T>) -> ComponentId
fn from(to_component_id: ComponentIdFor<T>) -> ComponentId
source§impl<'s, T: Component> From<Local<'s, ComponentIdFor<T>>> for ComponentId
impl<'s, T: Component> From<Local<'s, ComponentIdFor<T>>> for ComponentId
source§fn from(to_component_id: Local<'_, ComponentIdFor<T>>) -> ComponentId
fn from(to_component_id: Local<'_, ComponentIdFor<T>>) -> ComponentId
source§impl Hash for ComponentId
impl Hash for ComponentId
source§impl Ord for ComponentId
impl Ord for ComponentId
source§fn cmp(&self, other: &ComponentId) -> Ordering
fn cmp(&self, other: &ComponentId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<ComponentId> for ComponentId
impl PartialEq<ComponentId> for ComponentId
source§fn eq(&self, other: &ComponentId) -> bool
fn eq(&self, other: &ComponentId) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ComponentId> for ComponentId
impl PartialOrd<ComponentId> for ComponentId
source§fn partial_cmp(&self, other: &ComponentId) -> Option<Ordering>
fn partial_cmp(&self, other: &ComponentId) -> 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 moresource§impl SparseSetIndex for ComponentId
impl SparseSetIndex for ComponentId
fn sparse_set_index(&self) -> usize
fn get_sparse_set_index(value: usize) -> Self
impl Copy for ComponentId
impl Eq for ComponentId
impl StructuralEq for ComponentId
impl StructuralPartialEq for ComponentId
Auto Trait Implementations§
impl RefUnwindSafe for ComponentId
impl Send for ComponentId
impl Sync for ComponentId
impl Unpin for ComponentId
impl UnwindSafe for ComponentId
Blanket Implementations§
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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 + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.