Skip to main content

Module while

Module while 

Source
Expand description

Loop-while wrapper. Iterates the inner op as long as the op-template’s while: Polydat expression evaluates truthy. On each iteration the wrapper:

  1. Checks the activity-global stop flag. If set, the loop returns OpResult::skipped (no further iterations). Used to drain non-daemon while loops cleanly on session stop, and as a belt-and-braces secondary signal for daemon while loops (the daemon body’s tokio::select! cancels the future independently).
  2. Reads the synthesised __while binding via the pull plan. The op-kernel synthesis appends __while := <expr> to the kernel’s result bindings — same path metrics’ value expressions take — so referenced wires are auto-externed and read from the right cells.
  3. If the condition is falsy, returns OpResult::skipped (loop exit). Otherwise calls the inner dispenser; an Err propagates and breaks the loop, an Ok continues.

Composition: while: sits outer of result/metrics / traverse (so the inner’s result captures land before the next iteration’s predicate check) and inner of if: / memo (so the conditional short-circuit fires before the loop starts, and the memo emits after the loop concludes).

Structs§

WhileWrapper
Wraps an inner OpDispenser with a loop driven by a GK boolean expression. See module docs.

Constants§

BINDING_NAME
Internal kernel-output name the wrapper pulls. The op- kernel synthesiser appends __while := <expr> to the kernel’s result-bindings source so the expression’s free identifiers get auto-externed (same path metrics take).
NAME
Wrapper name.