pub trait Component: Send + Sync + Sized + 'static {
    const NAME: &'static str;
    const ID: ComponentTypeId = _;
    const DESCRIPTOR: ComponentDescriptor = _;
}
Expand description

Implement this trait to use a type as a component in the ECS. Do not override the default implementations for Self::ID or Self::DESCRIPTOR. Only implement Self::NAME.

Safety:

  • size_of must not exceed u16::MAX.
  • align_of must not exceed u16::MAX.

Required Associated Constants

Human readable program unique name used for calculating a stable type identifier.

Provided Associated Constants

Do not implement this manually. (Unless a hash collision occurs).

A descriptor defining the component type.

Implementors