Enum syntax::ast::Expr_ [−] [src]

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>),
}
Unstable

Variants

ExprBox
Unstable

First expr is the place; second expr is the value.

ExprVec
Unstable

An array ([a, b, c, d])

ExprCall
Unstable

A function call

The first field resolves to the function itself, and the second field is the list of arguments

ExprMethodCall
Unstable

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
Unstable

A tuple ((a, b, c ,d))

ExprBinary
Unstable

A binary operation (For example: a + b, a * b)

ExprUnary
Unstable

A unary operation (For example: !x, *x)

ExprLit
Unstable

A literal (For example: 1u8, "foo")

ExprCast
Unstable

A cast (foo as f64)

ExprIf
Unstable

An if block, with an optional else block

if expr { block } else { expr }

ExprIfLet
Unstable

An if let expression with an optional else block

if let pat = expr { block } else { expr }

This is desugared to a match expression.

ExprWhile
Unstable

A while loop, with an optional label

'label: while expr { block }

ExprWhileLet
Unstable

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
Unstable

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
Unstable

Conditionless loop (can be exited with break, continue, or return)

'label: loop { block }

ExprMatch
Unstable

A match block, with a source that indicates whether or not it is the result of a desugaring, and if so, which kind.

ExprClosure
Unstable

A closure (for example, move |a, b, c| {a + b + c})

ExprBlock
Unstable

A block ({ ... })

ExprAssign
Unstable

An assignment (a = foo())

ExprAssignOp
Unstable

An assignment with an operator

For example, a += 1.

ExprField
Unstable

Access of a named struct field (obj.foo)

ExprTupField
Unstable

Access of an unnamed field of a struct or tuple-struct

For example, foo.0.

ExprIndex
Unstable

An indexing operation (foo[2])

ExprRange
Unstable

A range (1..2, 1.., or ..2)

ExprPath
Unstable

Variable reference, possibly containing :: and/or type parameters, e.g. foo::bar::.

Optionally "qualified", e.g. <Vec<T> as SomeTrait>::SomeType.

ExprAddrOf
Unstable

A referencing operation (&a or &mut a)

ExprBreak
Unstable

A break, with an optional label to break

ExprAgain
Unstable

A continue, with an optional label

ExprRet
Unstable

A return, with an optional value to be returned

ExprInlineAsm
Unstable

Output of the asm!() macro

ExprMac
Unstable

A macro invocation; pre-expansion

ExprStruct
Unstable

A struct literal expression.

For example, Foo {x: 1, y: 2}, or Foo {x: 1, .. base}, where base is the Option<Expr>.

ExprRepeat
Unstable

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
Unstable

No-op: used solely so we can pretty-print faithfully

Trait Implementations

Derived Implementations

impl Debug for Expr_

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Hash for Expr_

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Decodable for Expr_

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Expr_, __D>

impl Encodable for Expr_

fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S>

impl Eq for Expr_

impl PartialEq for Expr_

fn eq(&self, __arg_0: &Expr_) -> bool

fn ne(&self, __arg_0: &Expr_) -> bool

impl Clone for Expr_

fn clone(&self) -> Expr_

fn clone_from(&mut self, source: &Self)