pub struct LoopConfig {
pub counter: Option<String>,
pub init: i64,
pub increment: i64,
pub max: i64,
/* private fields */
}Expand description
Engine-managed for loop over a workflow’s task list.
A workflow carrying a loop runs its task list repeatedly — one sweep
per iteration — rather than once. Per sweep the engine writes the counter
into temp_data (when counter names it), checks
counter < max, then re-evaluates the workflow condition; the sweep runs
only if both hold. Afterwards the counter advances by increment.
The bound is half-open, matching Rollout: init: 0, max: n yields
counter values 0..n-1 — exactly array indices.
Reaching max is normal completion, never an error: max is always
author-supplied, so hitting it is the stated bound rather than a runaway.
To stop mid-body, use a filter task with on_reject: halt — that breaks
the whole loop, not just the current sweep.
§Example
{
"id": "per_item",
"condition": {"<": [{"var": "temp_data.i"}, {"var": "temp_data.n"}]},
"loop": { "counter": "i", "max": 10000 },
"tasks": [ ... ]
}Fields§
§counter: Option<String>temp_data field the engine maintains as the induction variable —
"i" means temp_data.i, and dot-paths nest ("cursor.index" →
temp_data.cursor.index).
None still bounds the loop by max; the count is simply not exposed
to conditions or tasks. The engine tracks it either way, so the audit
trail carries it regardless.
The engine owns this field: it is rewritten before every sweep, so a body task writing the same path is overwritten at the next increment.
init: i64First counter value. Defaults to 0.
increment: i64Added to the counter after each sweep. Defaults to 1; must be >= 1,
so the counter strictly increases and the loop cannot stall.
max: i64Required upper bound — sweeps run while counter < max. There is no
default: an unbounded loop is never what the author meant, and the
bound is what makes termination structural rather than a property of
the condition being written correctly.
Trait Implementations§
Source§impl Clone for LoopConfig
impl Clone for LoopConfig
Source§fn clone(&self) -> LoopConfig
fn clone(&self) -> LoopConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more