[−][src]Trait keeshond::scene::Component
A data struct which may be added to an Entity
Provided methods
fn maintain_ordering() -> bool where
Self: Sized,
Self: Sized,
Whether to maintain insertion order when removing components. By default, the faster swap removal method is used, which disturbs the iteration order of the components in the store. Set this value to true to use a slower method that maintains the ordering. The performance penalty is based on the size of the data in the component type, so it is a good idea to enable this only for smaller components that need strict ordering.
fn capacity_hint() -> usize where
Self: Sized,
Self: Sized,
How many components of this type that memory should be reserved for in advance.
Methods
impl dyn Component
pub fn is<__T: Component>(&self) -> bool
Returns true if the trait object wraps an object of type __T
.
pub fn downcast<__T: Component>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
Returns a boxed object from a boxed trait object if the underlying object is of type
__T
. Returns the original boxed trait if it isn't.
pub fn downcast_ref<__T: Component>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn't.
pub fn downcast_mut<__T: Component>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn't.