MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / dispatch

Function dispatch

atomic-core/src/record/workflow/recipes/diff_op_rules.rs:250–260  ·  view source on GitHub ↗

Dispatch a single `DiffOp` through the rule table. Walks `RULES` top-to-bottom; the first `matches` predicate that returns `true` selects the rule whose `apply` is invoked. When no rule matches (e.g., for `DiffOp::Replace`, which the inline recipe still handles), returns `false` so the caller knows it must fall back to its own translation logic. Returns `true` when a rule fired.

(op: &DiffOp, ctx: &mut DiffOpContext<'_>)

Source from the content-addressed store, hash-verified

248///
249/// Returns `true` when a rule fired.
250pub fn dispatch(op: &DiffOp, ctx: &mut DiffOpContext<'_>) -> bool {
251 for rule in RULES {
252 if (rule.matches)(op, ctx) {
253 log::trace!("diff_op_rules::dispatch: matched {}", rule.name);
254 (rule.apply)(op, ctx);
255 return true;
256 }
257 }
258 log::trace!("diff_op_rules::dispatch: no rule matched, caller handles");
259 false
260}
261
262// Post-pass rules
263

Calls

no outgoing calls