shipyard/component.rs
1use crate::tracking::Tracking;
2
3/// Indicates that a `struct` or `enum` can be store in the `World`.
4#[cfg(feature = "thread_local")]
5pub trait Component: Sized + 'static {
6 /// Kind of event to track for this component.
7 type Tracking: Tracking;
8}
9/// Indicates that a `struct` or `enum` can be store in the `World`.
10#[cfg(not(feature = "thread_local"))]
11pub trait Component: Sized + Send + Sync + 'static {
12 /// Kind of event to track for this component.
13 type Tracking: Tracking;
14}
15
16/// Indicates that a `struct` or `enum` can be store a single time in the `World`.
17#[cfg(feature = "thread_local")]
18pub trait Unique: Sized + 'static {}
19/// Indicates that a `struct` or `enum` can be store a single time in the `World`.
20#[cfg(not(feature = "thread_local"))]
21pub trait Unique: Sized + Send + Sync + 'static {}