1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! `gen-platform` — Rust-first canonical handle for the typed-
//! dispatcher substrate primitive (typed-tagged-union catamorphism
//! at a language boundary). Re-exports `TypedDispatcher` +
//! `#[derive(TypedDispatcher)]`, ships a runtime `Dispatcher<T>`
//! applicator for Rust consumers (controllers, daemons, reactive
//! routers, migration runners, RBAC engines, render passes), and
//! surfaces typed catalog primitives so any pleme-io crate can
//! stand up a typed dispatch surface against any closed variant
//! universe with one cargo add.
//!
//! ## Why a dedicated crate
//!
//! The `mk-typed-dispatcher.nix` primitive proves the value at the
//! Nix dispatch layer. The same shape recurs across pleme-io
//! wherever a closed variant set drives an action (see
//! [`theory/QUIRK-APPLIER.md`](https://github.com/pleme-io/theory/blob/main/QUIRK-APPLIER.md)
//! §IV-bis.1 for the catalog). `gen-platform` is the canonical
//! Rust-side handle so consumers in pangea-operator, engenho
//! controllers, magma plan walkers, anomalia remediations, shinka
//! migrations etc. reach for the same primitive instead of hand-
//! rolling another `match` ladder.
//!
//! ## Surface
//!
//! ```ignore
//! use gen_platform::{Dispatcher, TypedDispatcher};
//!
//! #[derive(serde::Serialize, serde::Deserialize, gen_platform::TypedDispatcher)]
//! #[serde(tag = "kind", rename_all = "kebab-case")]
//! enum Migration {
//! AddColumn { table: String, column: String },
//! DropIndex { name: String },
//! }
//!
//! let dispatcher = Dispatcher::<Migration, MyCtx, MyOverride>::new()
//! .helper("add-column", |variant, ctx| { /* ... */ Default::default() })
//! .helper("drop-index", |variant, ctx| { /* ... */ Default::default() })
//! .into_sealed() // enforces variant coverage
//! .expect("every variant has a helper");
//!
//! let result = dispatcher.apply(&[migration_a, migration_b], &mut ctx);
//! ```
//!
//! ## Re-exports
//!
//! - `gen_types::TypedDispatcher` — the reflection trait.
//! - `gen_types::DispatcherVariant` — variant envelope shape.
//! - `gen_macros::TypedDispatcher` — `#[derive]` macro.
//!
//! ## New primitives (this crate)
//!
//! - `Dispatcher<V, C, O>` — runtime applicator. Holds typed
//! helpers per variant kind. `into_sealed()` proves coverage at
//! construction time (every reflected kind has a registered
//! helper) — silent unknown variants become impossible.
//! - `SealedDispatcher<V, C, O>` — the post-seal handle; `apply`
//! cannot fail on coverage anymore (proven at seal time).
//! - `DispatcherError` — typed error for build-time issues
//! (missing coverage, duplicate helpers).
//! - `MergeStrategy` — how to fold per-variant overrides.
pub use ;
pub use ;
pub use ;
pub use to_helpers_skeleton;
pub use MergeStrategy;
// Re-exports — single canonical Rust handle.
pub use ;
pub use ;