Trait shard_ecs::descriptors::component::Component[][src]

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.

Associated Constants

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

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

A descriptor defining the component type.

Implementors