pub trait Component:
Clone
+ 'static
+ Serialize
+ DeserializeOwned {
const NAME: &'static str;
}Expand description
A capability component (spec §3): a unit of data keyed by task Id in the
store. Presence of the value is the capability — there is no monolithic
Task struct; a task is the set of components attached to its id, fetched and
mutated one capability at a time (store.get::<Status>(id) /
store.set(id, Status::Wip)). NAME keys the per-capability map/table
(spec §7). Adding a capability = a new Component type; the generic store
needs no change.
The in-memory store only needs Clone + 'static (typed Box<dyn Any>); the
serde bounds are for durable stores that map a component to its row(s).
The Serialize/DeserializeOwned bound lets a store map a component
generically to/from its row(s): the Turso adapter (M2) bridges each value
through serde_json::to_value/from_value to its typed c_* column(s).
Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".