Component

Trait Component 

Source
pub trait Component:
    Clone
    + 'static
    + Send
    + Sync { }
Expand description

A marker trait for types that can be used as components in the ECS.

This trait must be implemented for any struct you wish to attach to an entity. The 'static lifetime ensures that the component type does not contain any non-static references, and Send + Sync are required to allow the component data to be safely accessed from multiple threads. Clone is required to allow component data to be moved between pages during structural changes (like adding or removing components).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Component for AudioListener

Source§

impl Component for AudioSource

Source§

impl Component for Camera

Source§

impl Component for Children

Source§

impl Component for GlobalTransform

Source§

impl Component for Light

Source§

impl Component for MaterialComponent

Source§

impl Component for Parent

Source§

impl Component for Transform

Source§

impl<T: Asset> Component for HandleComponent<T>

Implement the Component trait to make HandleComponent usable by the ECS.