Enum unrest_tmp_syn::ExprKind
[−]
[src]
pub enum ExprKind { Box(ExprBox), InPlace(ExprInPlace), Array(ExprArray), Call(ExprCall), MethodCall(ExprMethodCall), Tup(ExprTup), Binary(ExprBinary), Unary(ExprUnary), Lit(Lit), Cast(ExprCast), Type(ExprType), If(ExprIf), IfLet(ExprIfLet), While(ExprWhile), WhileLet(ExprWhileLet), ForLoop(ExprForLoop), Loop(ExprLoop), Match(ExprMatch), Closure(ExprClosure), Block(ExprBlock), Assign(ExprAssign), AssignOp(ExprAssignOp), Field(ExprField), TupField(ExprTupField), Index(ExprIndex), Range(ExprRange), Path(ExprPath), AddrOf(ExprAddrOf), Break(ExprBreak), Continue(ExprContinue), Ret(ExprRet), Mac(Mac), Struct(ExprStruct), Repeat(ExprRepeat), Paren(ExprParen), Group(ExprGroup), Try(ExprTry), Catch(ExprCatch), Yield(ExprYield), }
Variants
Box(ExprBox)
A box x
expression.
InPlace(ExprInPlace)
E.g. 'place <- val' or in place { val }
.
Array(ExprArray)
An array, e.g. [a, b, c, d]
.
Call(ExprCall)
A function call.
MethodCall(ExprMethodCall)
A method call (x.foo::<Bar, Baz>(a, b, c, d)
)
The Ident
is the identifier for the method name.
The vector of Ty
s are the ascripted type parameters for the method
(within the angle brackets).
Thus, x.foo::<Bar, Baz>(a, b, c, d)
is represented as
ExprKind::MethodCall(foo, [Bar, Baz], [x, a, b, c, d])
.
Tup(ExprTup)
A tuple, e.g. (a, b, c, d)
.
Binary(ExprBinary)
A binary operation, e.g. a + b
, a * b
.
Unary(ExprUnary)
A unary operation, e.g. !x
, *x
.
Lit(Lit)
A literal, e.g. 1
, "foo"
.
Cast(ExprCast)
A cast, e.g. foo as f64
.
Type(ExprType)
A type ascription, e.g. foo: f64
.
If(ExprIf)
An if
block, with an optional else block
E.g., if expr { block } else { expr }
IfLet(ExprIfLet)
An if let
expression with an optional else block
E.g., if let pat = expr { block } else { expr }
This is desugared to a match
expression.
While(ExprWhile)
A while loop, with an optional label
E.g., 'label: while expr { block }
WhileLet(ExprWhileLet)
A while-let loop, with an optional label.
E.g., 'label: while let pat = expr { block }
This is desugared to a combination of loop
and match
expressions.
ForLoop(ExprForLoop)
A for loop, with an optional label.
E.g., 'label: for pat in expr { block }
This is desugared to a combination of loop
and match
expressions.
Loop(ExprLoop)
Conditionless loop with an optional label.
E.g. 'label: loop { block }
Match(ExprMatch)
A match
block.
Closure(ExprClosure)
A closure (for example, move |a, b, c| a + b + c
)
Block(ExprBlock)
A block ({ ... }
or unsafe { ... }
)
Assign(ExprAssign)
An assignment (a = foo()
)
AssignOp(ExprAssignOp)
An assignment with an operator
For example, a += 1
.
Field(ExprField)
Access of a named struct field (obj.foo
)
TupField(ExprTupField)
Access of an unnamed field of a struct or tuple-struct
For example, foo.0
.
Index(ExprIndex)
An indexing operation (foo[2]
)
Range(ExprRange)
A range (1..2
, 1..
, ..2
, 1...2
, 1...
, ...2
)
Path(ExprPath)
Variable reference, possibly containing ::
and/or type
parameters, e.g. foo::bar::
Optionally "qualified",
E.g. <Vec<T> as SomeTrait>::SomeType
.
AddrOf(ExprAddrOf)
A referencing operation (&a
or &mut a
)
Break(ExprBreak)
A break
, with an optional label to break, and an optional expression
Continue(ExprContinue)
A continue
, with an optional label
Ret(ExprRet)
A return
, with an optional value to be returned
Mac(Mac)
A macro invocation; pre-expansion
Struct(ExprStruct)
A struct literal expression.
For example, Foo {x: 1, y: 2}
, or
Foo {x: 1, .. base}
, where base
is the Option<Expr>
.
Repeat(ExprRepeat)
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.
Paren(ExprParen)
No-op: used solely so we can pretty-print faithfully
Group(ExprGroup)
No-op: used solely so we can pretty-print faithfully
A group
represents a None
-delimited span in the input
TokenStream
which affects the precidence of the resulting
expression. They are used for macro hygiene.
Try(ExprTry)
expr?
Catch(ExprCatch)
A catch expression.
E.g. do catch { block }
Yield(ExprYield)
A yield expression.
E.g. yield expr
Trait Implementations
impl Clone for ExprKind
[src]
fn clone(&self) -> ExprKind
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
impl From<ExprBox> for ExprKind
[src]
impl From<ExprInPlace> for ExprKind
[src]
fn from(e: ExprInPlace) -> ExprKind
Performs the conversion.
impl From<ExprArray> for ExprKind
[src]
impl From<ExprCall> for ExprKind
[src]
impl From<ExprMethodCall> for ExprKind
[src]
fn from(e: ExprMethodCall) -> ExprKind
Performs the conversion.
impl From<ExprTup> for ExprKind
[src]
impl From<ExprBinary> for ExprKind
[src]
fn from(e: ExprBinary) -> ExprKind
Performs the conversion.
impl From<ExprUnary> for ExprKind
[src]
impl From<Lit> for ExprKind
[src]
impl From<ExprCast> for ExprKind
[src]
impl From<ExprType> for ExprKind
[src]
impl From<ExprIf> for ExprKind
[src]
impl From<ExprIfLet> for ExprKind
[src]
impl From<ExprWhile> for ExprKind
[src]
impl From<ExprWhileLet> for ExprKind
[src]
fn from(e: ExprWhileLet) -> ExprKind
Performs the conversion.
impl From<ExprForLoop> for ExprKind
[src]
fn from(e: ExprForLoop) -> ExprKind
Performs the conversion.
impl From<ExprLoop> for ExprKind
[src]
impl From<ExprMatch> for ExprKind
[src]
impl From<ExprClosure> for ExprKind
[src]
fn from(e: ExprClosure) -> ExprKind
Performs the conversion.
impl From<ExprBlock> for ExprKind
[src]
impl From<ExprAssign> for ExprKind
[src]
fn from(e: ExprAssign) -> ExprKind
Performs the conversion.
impl From<ExprAssignOp> for ExprKind
[src]
fn from(e: ExprAssignOp) -> ExprKind
Performs the conversion.
impl From<ExprField> for ExprKind
[src]
impl From<ExprTupField> for ExprKind
[src]
fn from(e: ExprTupField) -> ExprKind
Performs the conversion.
impl From<ExprIndex> for ExprKind
[src]
impl From<ExprRange> for ExprKind
[src]
impl From<ExprPath> for ExprKind
[src]
impl From<ExprAddrOf> for ExprKind
[src]
fn from(e: ExprAddrOf) -> ExprKind
Performs the conversion.
impl From<ExprBreak> for ExprKind
[src]
impl From<ExprContinue> for ExprKind
[src]
fn from(e: ExprContinue) -> ExprKind
Performs the conversion.
impl From<ExprRet> for ExprKind
[src]
impl From<Mac> for ExprKind
[src]
impl From<ExprStruct> for ExprKind
[src]
fn from(e: ExprStruct) -> ExprKind
Performs the conversion.
impl From<ExprRepeat> for ExprKind
[src]
fn from(e: ExprRepeat) -> ExprKind
Performs the conversion.