Trait libre_pvz_animation::curve::AnyComponent

source ·
pub trait AnyComponent<Target: ?Sized = dyn Any> {
    // Required methods
    fn component(&self) -> &Target;
    fn component_mut(&mut self) -> &mut Target;
}
Expand description

Bevy tracks changes in mutable references like Mut. We use this interface to avoid unnecessarily marking the target component as changed.

Required Methods§

source

fn component(&self) -> &Target

Read the current value of the component.

source

fn component_mut(&mut self) -> &mut Target

Borrow the component as mutable and mark it dirty.

Trait Implementations§

source§

impl<'a, C: 'static> TryFrom<&'a mut dyn AnyComponent> for UnwrapAnyComponent<'a, C>

§

type Error = String

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a mut dyn AnyComponent) -> Result<Self, String>

Performs the conversion.

Implementations on Foreign Types§

source§

impl<'a, C> AnyComponent<C> for Mut<'a, C>

source§

fn component(&self) -> &C

source§

fn component_mut(&mut self) -> &mut C

source§

impl<'a, C: 'static> AnyComponent for Mut<'a, C>

source§

fn component(&self) -> &dyn Any

source§

fn component_mut(&mut self) -> &mut dyn Any

Implementors§

source§

impl<'a, C: 'static> AnyComponent<C> for UnwrapAnyComponent<'a, C>