Skip to main content

ConcreteComponent

Trait ConcreteComponent 

Source
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§

Source

const TYPE_NAME: &'static str

Stable identifier. Convention: <crate>::<TypeName>.

Provided Associated Constants§

Source

const PACKAGE: ComponentPackage = ComponentPackage::Application

Origin tag; defaults to Application.

Source

const DEPENDENCIES: &'static [DependencyDecl] = _

Sibling components this depends on. Populated by the bb::Concrete derive from #[bb::depends(...)].

Required Associated Types§

Source

type Config: Any + 'static

Per-deployment config. Use () for stateless concretes.

Source

type Error: Error + Send + Sync + 'static

Error from Self::new; use Infallible if construction can’t fail.

Required Methods§

Source

fn new(config: &Self::Config) -> Result<Self, Self::Error>

Construct from &Self::Config. Install calls this once per slot.

Source

fn serialize(&self) -> Vec<u8>

Serialize state to bytes, including config-derived fields.

Source

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".

Implementors§

Source§

impl ConcreteComponent for ConstantView

Source§

const TYPE_NAME: &'static str = "ConstantView"

Source§

const PACKAGE: ComponentPackage = ::bytesandbrains::concrete::ComponentPackage::Application

Source§

const DEPENDENCIES: &'static [DependencyDecl]

Source§

type Config = ()

Source§

type Error = Infallible

Source§

impl ConcreteComponent for CpuBackend

Source§

const TYPE_NAME: &'static str = "bytesandbrains::backends::cpu::CpuBackend"

Source§

const PACKAGE: ComponentPackage = ComponentPackage::Framework

Source§

type Config = ()

Source§

type Error = Infallible

Source§

impl ConcreteComponent for GlobalRegistryClient

Source§

const TYPE_NAME: &'static str = "GlobalRegistryClient"

Source§

const PACKAGE: ComponentPackage = ::bytesandbrains::concrete::ComponentPackage::Application

Source§

const DEPENDENCIES: &'static [DependencyDecl]

Source§

type Config = ()

Source§

type Error = Infallible

Source§

impl ConcreteComponent for GlobalRegistryServer

Source§

const TYPE_NAME: &'static str = "GlobalRegistryServer"

Source§

const PACKAGE: ComponentPackage = ::bytesandbrains::concrete::ComponentPackage::Application

Source§

const DEPENDENCIES: &'static [DependencyDecl]

Source§

type Config = ()

Source§

type Error = Infallible

Source§

impl<B> ConcreteComponent for FedAvg<B>
where B: 'static + Default + Backend,

Source§

const TYPE_NAME: &'static str = "FedAvg"

Source§

const PACKAGE: ComponentPackage = ComponentPackage::Framework

Source§

const DEPENDENCIES: &'static [DependencyDecl]

Source§

type Config = ()

Source§

type Error = Infallible