pub trait Component:
Sized
+ Send
+ Debug
+ 'static {
const NAME: &'static str;
// Provided methods
fn from_baked(_bytes: &[u8]) -> Result<Self, CnResult> { ... }
fn inject_locator(&mut self, _locator: PayloadLocator) { ... }
fn inject_name(&mut self, _id: AssetId) { ... }
}Expand description
Component – pure serializable data, no behavior. The runtime-facing surface
only: a component loads from its baked blob bytes and receives its injected
identity/payload hooks. All authoring metadata (origin, payload kind,
reference fields, args schema, validators) lives in the build-side registry
(concinnity-world), derived from the for_each_component! metadata blocks.
Required Associated Constants§
Provided Methods§
Sourcefn from_baked(_bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(_bytes: &[u8]) -> Result<Self, CnResult>
Reconstruct this component from a blob record, whose bytes are the serialized runtime component (cook already ran the asset -> component translation). The default rejects: runtime-only components are never stored in a blob, so only loadable types provide an implementation.
Sourcefn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Called after construction to inject the payload locator from the blob def. Only meaningful for components with a compiled payload. The default implementation does nothing (correct for most components).
Sourcefn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Called after construction to inject the asset’s identity from the blob def. Only meaningful for components that look themselves up by id at runtime. The default implementation does nothing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".