Enum syntex_syntax::ast::Expr_
[−]
[src]
pub enum Expr_ { ExprBox(P<Expr>), ExprInPlace(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>), ExprType(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>), 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<SpannedIdent>), ExprAgain(Option<SpannedIdent>), 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(P<Expr>)
A box x
expression.
ExprInPlace(P<Expr>, P<Expr>)
First expr is the place; second expr is the value.
ExprVec(Vec<P<Expr>>)
An array ([a, b, c, d]
)
ExprCall(P<Expr>, Vec<P<Expr>>)
A function call
The first field resolves to the function itself, and the second field is the list of arguments
ExprMethodCall(SpannedIdent, Vec<P<Ty>>, Vec<P<Expr>>)
A method call (x.foo::<Bar, Baz>(a, b, c, d)
)
The SpannedIdent
is the identifier for the method name.
The vector of Ty
s are the ascripted type parameters for the method
(within the angle brackets).
The first element of the vector of Expr
s 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(Vec<P<Expr>>)
A tuple ((a, b, c ,d)
)
ExprBinary(BinOp, P<Expr>, P<Expr>)
A binary operation (For example: a + b
, a * b
)
ExprUnary(UnOp, P<Expr>)
A unary operation (For example: !x
, *x
)
ExprLit(P<Lit>)
A literal (For example: 1u8
, "foo"
)
ExprCast(P<Expr>, P<Ty>)
A cast (foo as f64
)
ExprType(P<Expr>, P<Ty>)
ExprIf(P<Expr>, P<Block>, Option<P<Expr>>)
An if
block, with an optional else block
if expr { block } else { expr }
ExprIfLet(P<Pat>, P<Expr>, P<Block>, Option<P<Expr>>)
An if let
expression with an optional else block
if let pat = expr { block } else { expr }
This is desugared to a match
expression.
ExprWhile(P<Expr>, P<Block>, Option<Ident>)
A while loop, with an optional label
'label: while expr { block }
ExprWhileLet(P<Pat>, P<Expr>, P<Block>, Option<Ident>)
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(P<Pat>, P<Expr>, P<Block>, Option<Ident>)
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(P<Block>, Option<Ident>)
Conditionless loop (can be exited with break, continue, or return)
'label: loop { block }
ExprMatch(P<Expr>, Vec<Arm>)
A match
block.
ExprClosure(CaptureClause, P<FnDecl>, P<Block>)
A closure (for example, move |a, b, c| {a + b + c}
)
ExprBlock(P<Block>)
A block ({ ... }
)
ExprAssign(P<Expr>, P<Expr>)
An assignment (a = foo()
)
ExprAssignOp(BinOp, P<Expr>, P<Expr>)
An assignment with an operator
For example, a += 1
.
ExprField(P<Expr>, SpannedIdent)
Access of a named struct field (obj.foo
)
ExprTupField(P<Expr>, Spanned<usize>)
Access of an unnamed field of a struct or tuple-struct
For example, foo.0
.
ExprIndex(P<Expr>, P<Expr>)
An indexing operation (foo[2]
)
ExprRange(Option<P<Expr>>, Option<P<Expr>>)
A range (1..2
, 1..
, or ..2
)
ExprPath(Option<QSelf>, Path)
Variable reference, possibly containing ::
and/or type
parameters, e.g. foo::bar::
Optionally "qualified",
e.g. <Vec<T> as SomeTrait>::SomeType
.
ExprAddrOf(Mutability, P<Expr>)
A referencing operation (&a
or &mut a
)
ExprBreak(Option<SpannedIdent>)
A break
, with an optional label to break
ExprAgain(Option<SpannedIdent>)
A continue
, with an optional label
ExprRet(Option<P<Expr>>)
A return
, with an optional value to be returned
ExprInlineAsm(InlineAsm)
Output of the asm!()
macro
ExprMac(Mac)
A macro invocation; pre-expansion
ExprStruct(Path, Vec<Field>, Option<P<Expr>>)
A struct literal expression.
For example, Foo {x: 1, y: 2}
, or
Foo {x: 1, .. base}
, where base
is the Option<Expr>
.
ExprRepeat(P<Expr>, P<Expr>)
An array 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(P<Expr>)
No-op: used solely so we can pretty-print faithfully
Trait Implementations
impl Debug for Expr_
[src]
impl Hash for Expr_
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl Decodable for Expr_
[src]
impl Encodable for Expr_
[src]
impl Eq for Expr_
[src]
impl PartialEq for Expr_
[src]
fn eq(&self, __arg_0: &Expr_) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Expr_) -> bool
This method tests for !=
.
impl Clone for Expr_
[src]
fn clone(&self) -> Expr_
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more