#[non_exhaustive]pub enum Expr {
Show 20 variants
Null,
Bool(bool),
Int(i64),
Float(f64),
String(SmolStr),
Var(VarId),
Prop {
target: Box<Expr>,
prop: SmolStr,
},
Index {
target: Box<Expr>,
index: Box<Expr>,
},
Slice {
target: Box<Expr>,
start: Option<Box<Expr>>,
end: Option<Box<Expr>>,
},
List(Vec<Expr>),
Map(Vec<(SmolStr, Expr)>),
Call {
func: SmolStr,
args: Vec<Expr>,
},
BinOp {
op: BinOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
},
UnaryOp {
op: UnaryOp,
operand: Box<Expr>,
},
Case {
scrutinee: Option<Box<Expr>>,
arms: Vec<(Expr, Expr)>,
otherwise: Option<Box<Expr>>,
},
IsNull {
operand: Box<Expr>,
negated: bool,
},
InList {
operand: Box<Expr>,
list: Box<Expr>,
},
ListPredicate {
kind: ListPredKind,
var: VarId,
iterable: Box<Expr>,
predicate: Option<Box<Expr>>,
},
Param {
name: SmolStr,
},
Exists {
pattern: Box<ReadOp>,
},
}Expand description
Plan-level expression IR. Spec §12.2.
Every variable reference carries its VarId; every function call is
resolved by name. This is a distinct type from cyrs_hir::Expr:
it is fully resolved (no cyrs_hir::Expr::Unresolved, no
cyrs_hir::Expr::PatternPredicate, no MapProjection), and VarIds
are plan-scoped rather than HIR-scoped (spec §12.3). The HIR→Plan lowering
pass (bead cy-foy) maps between them.
§Equality of floats
Eq is manually implemented so that aggregates of Expr can derive
Eq. Semantic equality for execution (e.g. NaN != NaN) is the
consumer’s responsibility. The Plan IR treats float bit patterns as opaque
for structural equality checks (spec §17.14 determinism).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
The null literal. Spec §12.2 E1.
Bool(bool)
A boolean literal (true / false). Spec §12.2 E2.
Int(i64)
A 64-bit signed integer literal. Spec §12.2 E3.
Float(f64)
A 64-bit IEEE-754 float literal. Spec §12.2 E4.
String(SmolStr)
A string literal. Spec §12.2 E5.
Var(VarId)
A resolved variable reference. Spec §12.2 E6.
Prop
A property access (expr.prop). Spec §12.2 E7.
Fields
Index
A subscript / index access (expr[index]). Spec §12.2 E8.
Fields
Slice
A list slice (expr[start..end]). cy-7s6.1 (spec §12.2 E8,
extended for openCypher list slicing).
Either bound may be None to represent the elided form:
xs[..j] -> start = None, end = Some(j); xs[i..] ->
start = Some(i), end = None. Negative indices carry their
from-end meaning at evaluation time; the plan does not
normalise them.
Fields
List(Vec<Expr>)
A list literal ([e1, e2, ...]). Spec §12.2 E9.
Map(Vec<(SmolStr, Expr)>)
A map literal ({k1: e1, k2: e2}). Spec §12.2 E10.
Call
A resolved function call. Spec §12.2 E11.
func is the canonical lower-case function name as resolved by the
built-in catalog (spec §8.3) or the consumer-provided catalog.
BinOp
A binary operator application. Spec §12.2 E12.
UnaryOp
A unary operator application. Spec §12.2 E13.
Case
A CASE expression. Spec §12.2 E14.
scrutinee is present for simple CASE x WHEN … form; absent for
searched CASE WHEN cond THEN … form.
Fields
IsNull
x IS NULL / x IS NOT NULL. Spec §12.2 E15.
InList
x IN list membership test. Spec §12.2 E16.
ListPredicate
A list predicate — ANY|ALL|NONE|SINGLE(v IN xs [WHERE p(v)])
(cy-8x5). Result type is Bool.
Mirrors the HIR shape: the binder var is scoped to the
predicate sub-expression only; the iterable evaluates in the
enclosing row scope. predicate is None for the bare form
(ANY(x IN xs) — true iff xs is non-empty).
Fields
kind: ListPredKindWhich of the four list predicates.
Param
A query parameter reference. Spec §12.4.
The consumer binds parameter values at execution time. The plan does
not carry values. ty is deferred to bead cy-foy (HIR→Plan lowering)
because type inference runs in cyrs-sema, which is not a
dependency of this crate.
Exists
A pattern-predicate existential check — EXISTS(<pattern>) in
expression position (cy-lve, spec §6.1 / §19 row “Pattern
predicates in expressions”).
Evaluates to true iff the embedded read sub-plan would yield
at least one row when evaluated against the enclosing row’s
variable bindings. Result type is Bool.
The pattern sub-tree is embedded directly (like
ReadOp::OptionalJoin) because a pattern predicate is always
a fresh sub-plan at the point it appears in the enclosing
expression — its shape cannot be shared with other operators in
the outer DAG. Variables that appear both inside the pattern and
in the outer row remain unified via VarId (plan-scoped),
consistent with the rest of the plan’s variable model.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Expr
impl<'de> Deserialize<'de> for Expr
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
impl Eq for Expr
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.