pub trait ComponentFactory: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn kind(&self) -> &'static str;
fn depends_on(&self) -> Vec<String>;
fn build<'life0, 'async_trait>(
self: Box<Self>,
config: Value,
ctx: &'life0 ComponentContext,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn AnyComponent>, RegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Type-erased factory for a concrete Component type. The registry
holds factories as Box<dyn ComponentFactory> so it can drive
heterogeneous types uniformly.
Required Methods§
Sourcefn depends_on(&self) -> Vec<String>
fn depends_on(&self) -> Vec<String>
Names of components this component depends on.
Sourcefn build<'life0, 'async_trait>(
self: Box<Self>,
config: Value,
ctx: &'life0 ComponentContext,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn AnyComponent>, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn build<'life0, 'async_trait>(
self: Box<Self>,
config: Value,
ctx: &'life0 ComponentContext,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn AnyComponent>, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Build an AnyComponent from the raw configuration value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".