pub struct Expr { /* private fields */ }Expand description
A parsed, ready-to-evaluate condition expression.
Produced by parse and evaluated by Expr::eval. It owns its whole AST,
borrows nothing, and holds no IO, clock, or randomness, so it is safe to keep
and re-evaluate for the life of a run.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn eval(&self, value: &Value) -> bool
pub fn eval(&self, value: &Value) -> bool
Evaluates the expression against a routed value, always returning a
bool.
This is TOTAL: it never panics and never errors for any value. The
missing-path, type-mismatch, and number-comparison semantics are those
documented on the module. Eval is a single linear walk of the
AST, whose size is bounded by MAX_EXPRESSION_LEN.
Sourcepub fn paths(&self) -> Vec<&[Segment]>
pub fn paths(&self) -> Vec<&[Segment]>
Every path this expression reads, in the order the source names them, as borrowed segment slices.
Literal operands are not paths and do not appear. A path repeated in the source appears once per mention, because this reports what the expression READS rather than a de-duplicated set of locations.
Exported for the same reason compare is: a second consumer needs the
expression’s own answer rather than one re-derived beside it. The graph
validator checks a fold’s stop_when against the declared shape of the
value it will read, and the only honest source for “which locations does
this predicate read” is the parse that already found them. Eval is
untouched: this walks the same AST and changes nothing about it.