pub struct Dispatcher<V, C, O>where
V: TypedDispatcher,{ /* private fields */ }Expand description
Unsealed dispatcher builder. Register helpers per variant kind,
then call into_sealed() to prove coverage.
Implementations§
Source§impl<V, C, O> Dispatcher<V, C, O>where
V: TypedDispatcher,
impl<V, C, O> Dispatcher<V, C, O>where
V: TypedDispatcher,
Sourcepub fn with_strategy(self, strategy: MergeStrategy) -> Self
pub fn with_strategy(self, strategy: MergeStrategy) -> Self
Override the merge strategy used by apply when folding
per-variant overrides. Defaults to OverrideLast.
Sourcepub fn helper<F>(self, kind: &str, f: F) -> Result<Self, DispatcherError>
pub fn helper<F>(self, kind: &str, f: F) -> Result<Self, DispatcherError>
Register a helper for a kind. Returns DuplicateHelper if
the kind already has one — pleme-io’s typed-dispatch rule
is: one kind, one helper.
§Errors
Returns DispatcherError::DuplicateHelper if a helper for
kind has already been registered.
Sourcepub fn with_helper<F>(self, kind: &str, f: F) -> Self
pub fn with_helper<F>(self, kind: &str, f: F) -> Self
Convenience: register a helper, panic on duplicate. Use only when you control both sides of the registration and want builder-style ergonomics.
Sourcepub fn into_sealed(self) -> Result<SealedDispatcher<V, C, O>, DispatcherError>
pub fn into_sealed(self) -> Result<SealedDispatcher<V, C, O>, DispatcherError>
Seal the dispatcher — asserts every kind in
V::variant_kinds() has a registered helper. Returns a
SealedDispatcher that can apply variants without runtime
coverage checks.
§Errors
Returns DispatcherError::MissingCoverage if any kind in
the variant universe has no registered helper.