pub enum ExprKind {
Show 21 variants
NumberLit(f64),
StringLit(String),
StringInterpolation(Vec<StringPart>),
BoolLit(bool),
NilLit,
ListLit(Vec<Expr>),
RecordLit(Vec<RecordEntry>),
Identifier(String),
Call {
name: Ident,
args: Vec<Expr>,
},
QualifiedCall {
module: Ident,
function: Ident,
args: Vec<Expr>,
},
FieldAccess {
object: Box<Expr>,
field: Ident,
},
MethodCall {
object: Box<Expr>,
method: Ident,
args: Vec<Expr>,
},
Binary {
left: Box<Expr>,
op: BinOp,
right: Box<Expr>,
},
Unary {
op: UnaryOp,
operand: Box<Expr>,
},
ResultUnwrap(Box<Expr>),
NilCoalesce {
left: Box<Expr>,
right: Box<Expr>,
},
If(Box<IfExpr>),
For(Box<ForExpr>),
Match(Box<MatchExpr>),
Lambda(Box<LambdaExpr>),
Paren(Box<Expr>),
}Expand description
The kind of expression.
Variants§
NumberLit(f64)
42, 3.14
StringLit(String)
"hello" (no interpolation)
StringInterpolation(Vec<StringPart>)
"hello ${name}" — parts alternate: string, expr, string, expr, string
BoolLit(bool)
true / false
NilLit
nil
ListLit(Vec<Expr>)
[expr, ...]
RecordLit(Vec<RecordEntry>)
{ field: expr, ...spread, ... }
Identifier(String)
my_var, count
Call
func(args...) — unqualified call
QualifiedCall
module.function(args...) — qualified (stdlib) call
FieldAccess
expr.field
MethodCall
expr.method(args...)
Binary
a + b, a == b, a and b, etc.
Unary
-x, not x
ResultUnwrap(Box<Expr>)
expr? — Result unwrap
NilCoalesce
a ?? b — nil-coalescing
If(Box<IfExpr>)
if cond { ... } [else { ... }]
For(Box<ForExpr>)
for item [, index] in expr { ... }
Match(Box<MatchExpr>)
match expr { arms... }
Lambda(Box<LambdaExpr>)
fn(params) { body }
Paren(Box<Expr>)
(expr)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ExprKind
impl<'de> Deserialize<'de> for ExprKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ExprKind
Auto Trait Implementations§
impl Freeze for ExprKind
impl RefUnwindSafe for ExprKind
impl Send for ExprKind
impl Sync for ExprKind
impl Unpin for ExprKind
impl UnwindSafe for ExprKind
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
Mutably borrows from an owned value. Read more