pub enum Expr {
Show 18 variants
Path {
at: String,
},
Lit {
value: Value,
},
Eq {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Ne {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Lt {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Le {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Gt {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Ge {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Not {
operand: Box<Expr>,
},
And {
operands: Vec<Expr>,
},
Or {
operands: Vec<Expr>,
},
Exists {
at: String,
},
Add {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Sub {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Mul {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Div {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Len {
of: Box<Expr>,
},
In {
needle: Box<Expr>,
haystack: Box<Expr>,
},
}Expand description
flow.ir Expr op.
Discriminated with op tag, deny_unknown_fields, rename_all = "snake_case".
Ops:
- read / literal:
Path/Lit - comparison:
Eq/Ne/Lt/Le/Gt/Ge - boolean:
Not/And/Or - existence:
Exists(Path lookup that returns bool instead of erroring) - arithmetic:
Add/Sub/Mul/Div - aggregate:
Len(length of array / string / object) /In(membership in array)
Variants§
Path
Path — read a value from ctx by simple $.a.b.c form.
Lit
Lit — literal JSON value.
Eq
Eq — boolean equality of two sub-expressions.
Ne
Ne — boolean inequality.
Lt
Lt — numeric lhs < rhs (both sides coerced to f64).
Le
Le — numeric lhs <= rhs.
Gt
Gt — numeric lhs > rhs.
Ge
Ge — numeric lhs >= rhs.
Not
Not — boolean negation of operand (truthy-based; null/false → true).
And
And — variadic boolean conjunction (short-circuit). Empty list → true.
Or
Or — variadic boolean disjunction (short-circuit). Empty list → false.
Exists
Exists — read a path; return true if it resolves, false if missing.
Distinct from Path (which raises PathNotFound) and from IsNull
(a present-but-null value resolves to true here).
Add
Add — numeric lhs + rhs (f64).
Sub
Sub — numeric lhs - rhs.
Mul
Mul — numeric lhs * rhs.
Div
Div — numeric lhs / rhs. Division by zero raises DispatcherError.
Len
Len — length of of: array → element count, string → char count,
object → key count. Other types raise DispatcherError.
In
In — true if needle equals any element of haystack (which must
evaluate to an array).