Skip to main content

Module dispatcher

Module dispatcher 

Source
Expand description

Runtime Dispatcher<V, C, O> — the Rust-side peer of mk-typed-dispatcher.nix. Same catamorphism, native enum types.

Type parameters:

  • V: the typed variant universe (a Rust enum implementing gen_types::TypedDispatcher). Used for compile-time coverage reflection.
  • C: the runtime context the helpers mutate / read.
  • O: the override type each helper produces. Folded across the variant list per the MergeStrategy.

Sealing: after Dispatcher::new() + N helper(...) calls, the consumer calls into_sealed(). The seal asserts that every kind in V::variant_kinds() has a registered helper — silent unknown variants become impossible at the type level. Missing coverage returns a typed DispatcherError.

Anti-pattern this primitive eliminates: hand-rolled match ladders sprinkled across pleme-io controllers/daemons/migration runners. Pillar 12 (generation over composition) applied at the Rust runtime layer.

Structs§

Dispatcher
Unsealed dispatcher builder. Register helpers per variant kind, then call into_sealed() to prove coverage.
SealedDispatcher
Post-seal dispatcher — coverage proved at construction. apply folds helpers over the variant list using the configured merge strategy.

Enums§

DispatcherError
Build-time / seal-time dispatcher error.