pub struct RedispatchRouter { /* private fields */ }Expand description
Routes Redispatch 2.0 RedispatchDocumentKinds to workflow names.
Constructed by crate::RedispatchModule::build_router during makod startup.
After construction the mapping is sealed — no runtime mutation.
§Registration order
Each RedispatchDocumentKind maps to exactly one workflow name. Duplicate
registrations overwrite the previous entry (last-write-wins), analogous
to PidRouter. Use cargo xtask validate-pruefids to detect conflicts.
Implementations§
Source§impl RedispatchRouter
impl RedispatchRouter
Sourcepub fn register(
&mut self,
doc_kind: RedispatchDocumentKind,
workflow_name: &'static str,
)
pub fn register( &mut self, doc_kind: RedispatchDocumentKind, workflow_name: &'static str, )
Register a mapping from doc_kind to workflow_name.
If doc_kind was already registered the new entry overwrites the
previous one. This mirrors the PidRouter contract.
Sourcepub fn route(
&self,
doc_kind: RedispatchDocumentKind,
) -> Result<&'static str, RoutingError>
pub fn route( &self, doc_kind: RedispatchDocumentKind, ) -> Result<&'static str, RoutingError>
Look up the workflow name for doc_kind.
Returns Ok(name) when a mapping was registered, or a RoutingError
when the document kind is unknown.
§Errors
Returns RoutingError when no workflow was registered for doc_kind.
Sourcepub fn is_registered(&self, doc_kind: RedispatchDocumentKind) -> bool
pub fn is_registered(&self, doc_kind: RedispatchDocumentKind) -> bool
Return true if doc_kind has a registered workflow.
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (RedispatchDocumentKind, &'static str)> + '_
pub fn iter( &self, ) -> impl Iterator<Item = (RedispatchDocumentKind, &'static str)> + '_
Iterate over all registered (RedispatchDocumentKind, workflow_name) pairs.
Trait Implementations§
Source§impl Clone for RedispatchRouter
impl Clone for RedispatchRouter
Source§fn clone(&self) -> RedispatchRouter
fn clone(&self) -> RedispatchRouter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more