Skip to main content

resolve_next

Function resolve_next 

pub fn resolve_next(ctx: &RouteCtx<'_>) -> NextStep
Expand description

Pick the next step, preserving linear behavior when no routing is declared.

Resolution precedence (highest to lowest). The branches are mutually exclusive — only one of them fires per call — so the linear narrative reads as a decision tree, not a fallback chain:

  1. False top-level when guard → terminal completes; otherwise the linear successor is taken. switch ports and routing.next are bypassed entirely.
  2. True or absent top-level when guard with a non-empty switch → the first matching port’s goto is taken, or the run completes if no port matches. routing.next and the linear successor are NOT consulted.
  3. True or absent top-level when guard with no switch and a declared routing.next → that explicit successor is taken (visit limit, dependency, and existence checks still apply).
  4. True or absent top-level when guard with no switch and no routing.nextterminal: true completes the run; otherwise the linear successor (current_step + 1) is taken.