pub trait ConcreteComponent: Sized + ErasedComponent {
type Config: Any + 'static;
type Error: Error + Send + Sync + 'static;
const TYPE_NAME: &'static str;
const PACKAGE: ComponentPackage = ComponentPackage::Application;
const DEPENDENCIES: &'static [DependencyDecl] = _;
// Required methods
fn new(config: &Self::Config) -> Result<Self, Self::Error>;
fn serialize(&self) -> Vec<u8> ⓘ;
fn restore(bytes: &[u8]) -> Result<Self, RestoreError>;
}Expand description
Polymorphism contract. Implementing this trait IS the
registration mechanism — no global registry, no macro
required. Serialized state must be self-contained so restore
reconstructs without the original Config.
Required Associated Constants§
Provided Associated Constants§
Sourceconst PACKAGE: ComponentPackage = ComponentPackage::Application
const PACKAGE: ComponentPackage = ComponentPackage::Application
Origin tag; defaults to Application.
Sourceconst DEPENDENCIES: &'static [DependencyDecl] = _
const DEPENDENCIES: &'static [DependencyDecl] = _
Sibling components this depends on. Populated by the
bb::Concrete derive from #[bb::depends(...)].
Required Associated Types§
Required Methods§
Sourcefn new(config: &Self::Config) -> Result<Self, Self::Error>
fn new(config: &Self::Config) -> Result<Self, Self::Error>
Construct from &Self::Config. Install calls this once per
slot.
Sourcefn restore(bytes: &[u8]) -> Result<Self, RestoreError>
fn restore(bytes: &[u8]) -> Result<Self, RestoreError>
Reconstruct from serialize output.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".