pub enum Expr_ {
ExprBox(Option<P<Expr>>, P<Expr>),
ExprVec(Vec<P<Expr>>),
ExprCall(P<Expr>, Vec<P<Expr>>),
ExprMethodCall(SpannedIdent, Vec<P<Ty>>, Vec<P<Expr>>),
ExprTup(Vec<P<Expr>>),
ExprBinary(BinOp, P<Expr>, P<Expr>),
ExprUnary(UnOp, P<Expr>),
ExprLit(P<Lit>),
ExprCast(P<Expr>, P<Ty>),
ExprIf(P<Expr>, P<Block>, Option<P<Expr>>),
ExprIfLet(P<Pat>, P<Expr>, P<Block>, Option<P<Expr>>),
ExprWhile(P<Expr>, P<Block>, Option<Ident>),
ExprWhileLet(P<Pat>, P<Expr>, P<Block>, Option<Ident>),
ExprForLoop(P<Pat>, P<Expr>, P<Block>, Option<Ident>),
ExprLoop(P<Block>, Option<Ident>),
ExprMatch(P<Expr>, Vec<Arm>, MatchSource),
ExprClosure(CaptureClause, P<FnDecl>, P<Block>),
ExprBlock(P<Block>),
ExprAssign(P<Expr>, P<Expr>),
ExprAssignOp(BinOp, P<Expr>, P<Expr>),
ExprField(P<Expr>, SpannedIdent),
ExprTupField(P<Expr>, Spanned<usize>),
ExprIndex(P<Expr>, P<Expr>),
ExprRange(Option<P<Expr>>, Option<P<Expr>>),
ExprPath(Option<QSelf>, Path),
ExprAddrOf(Mutability, P<Expr>),
ExprBreak(Option<Ident>),
ExprAgain(Option<Ident>),
ExprRet(Option<P<Expr>>),
ExprInlineAsm(InlineAsm),
ExprMac(Mac),
ExprStruct(Path, Vec<Field>, Option<P<Expr>>),
ExprRepeat(P<Expr>, P<Expr>),
ExprParen(P<Expr>),
}Variants
ExprBox | First expr is the place; second expr is the value.
|
ExprVec | |
ExprCall | A function call
The first field resolves to the function itself,
and the second field is the list of arguments
|
ExprMethodCall | A method call (x.foo::<Bar, Baz>(a, b, c, d))
The SpannedIdent is the identifier for the method name.
The vector of Tys are the ascripted type parameters for the method
(within the angle brackets).
The first element of the vector of Exprs is the expression that evaluates
to the object on which the method is being called on (the receiver),
and the remaining elements are the rest of the arguments.
Thus, x.foo::<Bar, Baz>(a, b, c, d) is represented as
ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d]).
|
ExprTup | |
ExprBinary | A binary operation (For example: a + b, a * b)
|
ExprUnary | A unary operation (For example: !x, *x)
|
ExprLit | A literal (For example: 1u8, "foo")
|
ExprCast | |
ExprIf | An if block, with an optional else block
if expr { block } else { expr }
|
ExprIfLet | An if let expression with an optional else block
if let pat = expr { block } else { expr }
This is desugared to a match expression.
|
ExprWhile | A while loop, with an optional label
'label: while expr { block }
|
ExprWhileLet | A while-let loop, with an optional label
'label: while let pat = expr { block }
This is desugared to a combination of loop and match expressions.
|
ExprForLoop | A for loop, with an optional label
'label: for pat in expr { block }
This is desugared to a combination of loop and match expressions.
|
ExprLoop | Conditionless loop (can be exited with break, continue, or return)
'label: loop { block }
|
ExprMatch | A match block, with a source that indicates whether or not it is
the result of a desugaring, and if so, which kind.
|
ExprClosure | A closure (for example, move |a, b, c| {a + b + c})
|
ExprBlock | |
ExprAssign | An assignment (a = foo())
|
ExprAssignOp | An assignment with an operator
For example, a += 1.
|
ExprField | Access of a named struct field (obj.foo)
|
ExprTupField | Access of an unnamed field of a struct or tuple-struct
For example, foo.0.
|
ExprIndex | An indexing operation (foo[2])
|
ExprRange | A range (1..2, 1.., or ..2)
|
ExprPath | Variable reference, possibly containing :: and/or type
parameters, e.g. foo::bar::.
Optionally "qualified",
e.g. <Vec<T> as SomeTrait>::SomeType.
|
ExprAddrOf | A referencing operation (&a or &mut a)
|
ExprBreak | A break, with an optional label to break
|
ExprAgain | A continue, with an optional label
|
ExprRet | A return, with an optional value to be returned
|
ExprInlineAsm | Output of the asm!() macro
|
ExprMac | A macro invocation; pre-expansion
|
ExprStruct | A struct literal expression.
For example, Foo {x: 1, y: 2}, or
Foo {x: 1, .. base}, where base is the Option<Expr>.
|
ExprRepeat | A vector literal constructed from one repeated element.
For example, [1u8; 5]. The first expression is the element
to be repeated; the second is the number of times to repeat it.
|
ExprParen | No-op: used solely so we can pretty-print faithfully
|
Trait Implementations
Derived Implementations