Enum syntax::ast::ExprKind [] [src]

pub enum ExprKind {
    Box(P<Expr>),
    InPlace(P<Expr>, P<Expr>),
    Array(Vec<P<Expr>>),
    Call(P<Expr>, Vec<P<Expr>>),
    MethodCall(PathSegmentVec<P<Expr>>),
    Tup(Vec<P<Expr>>),
    Binary(BinOpP<Expr>, P<Expr>),
    Unary(UnOpP<Expr>),
    Lit(P<Lit>),
    Cast(P<Expr>, P<Ty>),
    Type(P<Expr>, P<Ty>),
    If(P<Expr>, P<Block>, Option<P<Expr>>),
    IfLet(Vec<P<Pat>>, P<Expr>, P<Block>, Option<P<Expr>>),
    While(P<Expr>, P<Block>, Option<Label>),
    WhileLet(Vec<P<Pat>>, P<Expr>, P<Block>, Option<Label>),
    ForLoop(P<Pat>, P<Expr>, P<Block>, Option<Label>),
    Loop(P<Block>, Option<Label>),
    Match(P<Expr>, Vec<Arm>),
    Closure(CaptureByMovabilityP<FnDecl>, P<Expr>, Span),
    Block(P<Block>),
    Catch(P<Block>),
    Assign(P<Expr>, P<Expr>),
    AssignOp(BinOpP<Expr>, P<Expr>),
    Field(P<Expr>, SpannedIdent),
    TupField(P<Expr>, Spanned<usize>),
    Index(P<Expr>, P<Expr>),
    Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits),
    Path(Option<QSelf>, Path),
    AddrOf(MutabilityP<Expr>),
    Break(Option<Label>, Option<P<Expr>>),
    Continue(Option<Label>),
    Ret(Option<P<Expr>>),
    InlineAsm(P<InlineAsm>),
    Mac(Mac),
    Struct(PathVec<Field>, Option<P<Expr>>),
    Repeat(P<Expr>, P<Expr>),
    Paren(P<Expr>),
    Try(P<Expr>),
    Yield(Option<P<Expr>>),
}

Variants

A box x expression.

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

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

A function call

The first field resolves to the function itself, and the second field is the list of arguments. This also represents calling the constructor of tuple-like ADTs such as tuple structs and enum variants.

A method call (x.foo::<'static, Bar, Baz>(a, b, c, d))

The PathSegment represents the method name and its generic arguments (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 ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, [x, a, b, c, d]).

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

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

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

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

A cast (foo as f64)

An if block, with an optional else block

if expr { block } else { expr }

An if let expression with an optional else block

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

This is desugared to a match expression.

A while loop, with an optional label

'label: while expr { block }

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.

A for loop, with an optional label

'label: for pat in expr { block }

This is desugared to a combination of loop and match expressions.

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

'label: loop { block }

A match block.

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

The final span is the span of the argument block |...|

A block ({ ... })

A catch block (catch { ... })

An assignment (a = foo())

An assignment with an operator

For example, a += 1.

Access of a named struct field (obj.foo)

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

For example, foo.0.

An indexing operation (foo[2])

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

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

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

A referencing operation (&a or &mut a)

A break, with an optional label to break, and an optional expression

A continue, with an optional label

A return, with an optional value to be returned

Output of the asm!() macro

A macro invocation; pre-expansion

A struct literal expression.

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

An array literal constructed from one repeated element.

For example, [1; 5]. The first expression is the element to be repeated; the second is the number of times to repeat it.

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

expr?

A yield, with an optional value to be yielded

Trait Implementations

impl Clone for ExprKind
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for ExprKind
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for ExprKind
[src]

impl Encodable for ExprKind
[src]

[src]

impl Decodable for ExprKind
[src]

[src]

impl Hash for ExprKind
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for ExprKind
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !Send for ExprKind

impl !Sync for ExprKind