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

A box x expression.

ExprInPlace

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

ExprVec

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

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

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

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

A cast (foo as f64)

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.

ExprClosure

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

ExprBlock

A block ({ ... })

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

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

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

Trait Implementations

Derived Implementations

impl Debug for Expr_
[src]

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

Formats the value using the given formatter.

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]

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

impl Encodable for Expr_
[src]

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

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