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.
Sourcepub fn hooks(&self) -> &ComponentHooks
pub fn hooks(&self) -> &ComponentHooks
Provides a reference to the collection of hooks associated with this Component
Sourcepub fn required_components(&self) -> &RequiredComponents
pub fn required_components(&self) -> &RequiredComponents
Retrieves the RequiredComponents
collection, which contains all required components (and their constructors)
needed by this component. This includes recursive required components.
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 Freeze for ComponentInfo
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> 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.