Skip to main content

TypedDispatcher

Derive Macro TypedDispatcher 

Source
#[derive(TypedDispatcher)]
Expand description

#[derive(TypedDispatcher)] — auto-implement gen_types::TypedDispatcher on a Rust enum whose serde tag is #[serde(tag = "kind", rename_all = "kebab-case")].

The macro observes the enum’s variants and emits a trait impl reflecting the variant universe (kebab-case tags + per-variant field names). Substrate emitters consume the reflection to generate:

  • the Nix helpers = { ... } table skeleton for the matching substrate/lib/build/<eco>/quirk-apply.nix;
  • the Lisp catalog entry naming the dispatcher;
  • a coverage test asserting every variant has a consumer arm.

Only unit variants and named-field struct variants are supported (the serde-tagged-enum shape pleme-io uses universally). Tuple variants raise a compile error.