pub trait PackFactory:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn create(&self, runtime: KhiveRuntime) -> Box<dyn PackRuntime>;
// Provided method
fn requires(&self) -> &'static [&'static str] { ... }
}Expand description
Factory for creating pack instances registered via inventory at link time
(ADR-063). Each pack crate submits a &'static dyn PackFactory wrapped in a
PackRegistration; the binary’s linker collects them all into a single
slice iterable at runtime.
Implementors must be Send + Sync + 'static because the registry is built
once and shared across async tasks.
Required Methods§
Sourcefn create(&self, runtime: KhiveRuntime) -> Box<dyn PackRuntime>
fn create(&self, runtime: KhiveRuntime) -> Box<dyn PackRuntime>
Create a new pack instance for the given runtime.
Provided Methods§
Sourcefn requires(&self) -> &'static [&'static str]
fn requires(&self) -> &'static [&'static str]
Names of packs that must be loaded before this one (ADR-037).
Defaults to empty so pack crates that have no dependencies compile
without changes. PackRegistry::register_packs uses this to compute
the transitive closure of required packs before registering anything.