pub enum Expr {
Show 18 variants
Identity,
FieldAccess {
base: Box<Expr>,
fields: Vec<String>,
},
ArrayAccess {
array: Box<Expr>,
index: Box<Expr>,
},
ArraySlice {
array: Box<Expr>,
start: Option<Box<Expr>>,
end: Option<Box<Expr>>,
},
ArrayIteration(Box<Expr>),
FunctionCall {
name: String,
args: Vec<Expr>,
},
BinaryOp {
left: Box<Expr>,
op: BinaryOperator,
right: Box<Expr>,
},
UnaryOp {
op: UnaryOperator,
expr: Box<Expr>,
},
Assignment {
op: AssignmentOperator,
target: Box<Expr>,
value: Box<Expr>,
},
Object {
pairs: Vec<ObjectEntry>,
},
Array(Vec<Expr>),
Literal(Literal),
Identifier(String),
Variable(String),
Paren(Box<Expr>),
Pipeline(Vec<Expr>),
If {
condition: Box<Expr>,
then_branch: Box<Expr>,
else_branch: Box<Expr>,
},
Sequence(Vec<Expr>),
}Expand description
Core expression types in DSQ
Variants§
Identity
Identity filter (.)
FieldAccess
Field access (.field or .field.subfield)
ArrayAccess
Array access (.[index])
ArraySlice
Array slicing (.[start:end])
Fields
ArrayIteration(Box<Expr>)
Array iteration (.[])
FunctionCall
Function call (func(args…))
BinaryOp
Binary operation (left op right)
UnaryOp
Unary operation (op expr)
Assignment
Assignment operation (target += value or target |= value)
Fields
§
op: AssignmentOperatorAssignment operator
Object
Object construction ({key: value, …})
Fields
§
pairs: Vec<ObjectEntry>Key-value pairs
Array(Vec<Expr>)
Array construction ([item1, item2, …])
Literal(Literal)
Literal value
Identifier(String)
Identifier (bare word, could be function name or variable)
Variable(String)
Variable reference ($name)
Paren(Box<Expr>)
Parenthesized expression
Pipeline(Vec<Expr>)
Pipeline (expr1 | expr2 | …)
If
If-then-else expression (if condition then expr else expr end)
Fields
Sequence(Vec<Expr>)
Sequence (expr1, expr2, …)
Trait Implementations§
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 UnwindSafe for Expr
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> Key for Twhere
T: Clone,
impl<T> Key for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.