Skip to main content

unlit_ecs/
component.rs

1//! Components.
2//!
3//! A component is any `'static` type. Components live in archetypes, and an
4//! entity's set of components is fixed when it is spawned: components are only
5//! read and written, never added or removed. To change the set of components,
6//! despawn the entity and spawn a new one.
7
8/// A value stored on an entity.
9///
10/// This is implemented for every `'static` type, so it only serves as
11/// documentation and as a bound: it is what keeps a non-`'static` type from
12/// being used as a component.
13pub trait Component: 'static {}
14
15impl<T: 'static> Component for T {}