pub trait SpawnerFactoryKind: SpawnerFactory {
type Worker: Worker;
const KIND: AgentKind;
}Expand description
Companion trait that carries the type-side source of truth for
the Adapter ↔ AgentKind correspondence.
The base SpawnerFactory trait deliberately does not carry an
associated const so it stays dyn-compatible — that is, so it can be
stored and dispatched as Arc<dyn SpawnerFactory>. This companion
trait splits const KIND: AgentKind out, and
SpawnerRegistry::register uses F::KIND as the HashMap key.
That physically removes the string-lookup failure mode at the type
layer.
The three built-in factories (Shell / InProc / Operator)
implement this. Extension backends (say, AgentBlockSpawnerFactory)
follow the same explicit two-step recipe: add a new AgentKind
variant and implement this trait.
Required Associated Constants§
Required Associated Types§
Sourcetype Worker: Worker
type Worker: Worker
The concrete Worker type produced by this AgentKind — this
binds the type chain all the way from AgentKind down to Worker.
Every factory declares it so the AgentKind → Worker mapping is
explicit across all four layers. It is the source of truth for
preserving the concrete type right up until SpawnerAdapter::spawn
erases it into Box<dyn Worker>.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".