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).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Expr
impl<'de> Deserialize<'de> for Expr
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Expr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Expr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Expr
impl Serialize for Expr
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more