Struct bevy::ecs::component::ComponentInfo
source · pub struct ComponentInfo { /* private fields */ }
Expand description
Stores metadata for a type of component or resource stored in a specific World
.
Implementations§
source§impl ComponentInfo
impl ComponentInfo
sourcepub fn id(&self) -> ComponentId
pub fn id(&self) -> ComponentId
Returns a value uniquely identifying the current component.
sourcepub fn type_id(&self) -> Option<TypeId>
pub fn type_id(&self) -> Option<TypeId>
Returns the TypeId
of the underlying component type.
Returns None
if the component does not correspond to a Rust type.
sourcepub fn layout(&self) -> Layout
pub fn layout(&self) -> Layout
Returns the layout used to store values of this component in memory.
sourcepub fn drop(&self) -> Option<unsafe fn(_: OwningPtr<'_>)>
pub fn drop(&self) -> Option<unsafe fn(_: OwningPtr<'_>)>
Get the function which should be called to clean up values of
the underlying component type. This maps to the
Drop
implementation for ‘normal’ Rust components
Returns None
if values of the underlying component type don’t
need to be dropped, e.g. as reported by needs_drop
.
sourcepub fn storage_type(&self) -> StorageType
pub fn storage_type(&self) -> StorageType
Returns a value indicating the storage strategy for the current component.
sourcepub fn is_send_and_sync(&self) -> bool
pub fn is_send_and_sync(&self) -> bool
Returns true
if the underlying component type can be freely shared between threads.
If this returns false
, then extra care must be taken to ensure that components
are not accessed from the wrong thread.
Trait Implementations§
source§impl Clone for ComponentInfo
impl Clone for ComponentInfo
source§fn clone(&self) -> ComponentInfo
fn clone(&self) -> ComponentInfo
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for ComponentInfo
impl Send for ComponentInfo
impl Sync for ComponentInfo
impl Unpin for ComponentInfo
impl UnwindSafe for ComponentInfo
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.