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(PathSegment, Vec<P<Expr>>),
Tup(Vec<P<Expr>>),
Binary(BinOp, P<Expr>, P<Expr>),
Unary(UnOp, P<Expr>),
Lit(P<Lit>),
Cast(P<Expr>, P<Ty>),
Type(P<Expr>, P<Ty>),
If(P<Expr>, P<Block>, Option<P<Expr>>),
IfLet(P<Pat>, P<Expr>, P<Block>, Option<P<Expr>>),
While(P<Expr>, P<Block>, Option<SpannedIdent>),
WhileLet(P<Pat>, P<Expr>, P<Block>, Option<SpannedIdent>),
ForLoop(P<Pat>, P<Expr>, P<Block>, Option<SpannedIdent>),
Loop(P<Block>, Option<SpannedIdent>),
Match(P<Expr>, Vec<Arm>),
Closure(CaptureBy, P<FnDecl>, P<Expr>, Span),
Block(P<Block>),
Catch(P<Block>),
Assign(P<Expr>, P<Expr>),
AssignOp(BinOp, P<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(Mutability, P<Expr>),
Break(Option<SpannedIdent>, Option<P<Expr>>),
Continue(Option<SpannedIdent>),
Ret(Option<P<Expr>>),
InlineAsm(P<InlineAsm>),
Mac(Mac),
Struct(Path, Vec<Field>, Option<P<Expr>>),
Repeat(P<Expr>, P<Expr>),
Paren(P<Expr>),
Try(P<Expr>),
Yield(Option<P<Expr>>),
}🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Variants
Box(P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A box x expression.
InPlace(P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
First expr is the place; second expr is the value.
Array(Vec<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An array ([a, b, c, d])
Call(P<Expr>, Vec<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
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.
MethodCall(PathSegment, Vec<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
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]).
Tup(Vec<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A tuple ((a, b, c ,d))
Binary(BinOp, P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A binary operation (For example: a + b, a * b)
Unary(UnOp, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A unary operation (For example: !x, *x)
Lit(P<Lit>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A literal (For example: 1, "foo")
Cast(P<Expr>, P<Ty>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A cast (foo as f64)
Type(P<Expr>, P<Ty>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
If(P<Expr>, P<Block>, Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An if block, with an optional else block
if expr { block } else { expr }
IfLet(P<Pat>, P<Expr>, P<Block>, Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An if let expression with an optional else block
if let pat = expr { block } else { expr }
This is desugared to a match expression.
While(P<Expr>, P<Block>, Option<SpannedIdent>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A while loop, with an optional label
'label: while expr { block }
WhileLet(P<Pat>, P<Expr>, P<Block>, Option<SpannedIdent>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
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.
ForLoop(P<Pat>, P<Expr>, P<Block>, Option<SpannedIdent>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A for loop, with an optional label
'label: for pat in expr { block }
This is desugared to a combination of loop and match expressions.
Loop(P<Block>, Option<SpannedIdent>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Conditionless loop (can be exited with break, continue, or return)
'label: loop { block }
Match(P<Expr>, Vec<Arm>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A match block.
Closure(CaptureBy, P<FnDecl>, P<Expr>, Span)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A closure (for example, move |a, b, c| a + b + c)
The final span is the span of the argument block |...|
Block(P<Block>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A block ({ ... })
Catch(P<Block>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A catch block (catch { ... })
Assign(P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An assignment (a = foo())
AssignOp(BinOp, P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An assignment with an operator
For example, a += 1.
Field(P<Expr>, SpannedIdent)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Access of a named struct field (obj.foo)
TupField(P<Expr>, Spanned<usize>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Access of an unnamed field of a struct or tuple-struct
For example, foo.0.
Index(P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
An indexing operation (foo[2])
Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A range (1..2, 1.., ..2, 1...2, 1..., ...2)
Path(Option<QSelf>, Path)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Variable reference, possibly containing :: and/or type
parameters, e.g. foo::bar::
Optionally "qualified",
E.g. <Vec<T> as SomeTrait>::SomeType.
AddrOf(Mutability, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A referencing operation (&a or &mut a)
Break(Option<SpannedIdent>, Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A break, with an optional label to break, and an optional expression
Continue(Option<SpannedIdent>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A continue, with an optional label
Ret(Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A return, with an optional value to be returned
InlineAsm(P<InlineAsm>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Output of the asm!() macro
Mac(Mac)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A macro invocation; pre-expansion
Struct(Path, Vec<Field>, Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A struct literal expression.
For example, Foo {x: 1, y: 2}, or
Foo {x: 1, .. base}, where base is the Option<Expr>.
Repeat(P<Expr>, P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
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(P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
No-op: used solely so we can pretty-print faithfully
Try(P<Expr>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
expr?
Yield(Option<P<Expr>>)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
A yield, with an optional value to be yielded
Trait Implementations
impl Clone for ExprKind[src]
fn clone(&self) -> ExprKind[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq for ExprKind[src]
fn eq(&self, __arg_0: &ExprKind) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &ExprKind) -> bool[src]
This method tests for !=.
impl Eq for ExprKind[src]
impl Encodable for ExprKind[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Decodable for ExprKind[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<ExprKind, __D::Error>[src]
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Hash for ExprKind[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)[src]
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more