ExprKind

Enum ExprKind 

Source
pub enum ExprKind {
Show 47 variants Literal(Literal), Var { def_id: HirId, name: Symbol, }, Binary { op: BinOp, left: Box<Expr>, right: Box<Expr>, }, Unary { op: UnOp, expr: Box<Expr>, }, Call { func: Box<Expr>, args: Vec<Expr>, }, MethodCall { receiver: Box<Expr>, method: Symbol, args: Vec<Expr>, }, Field { expr: Box<Expr>, field: Symbol, field_idx: usize, }, Index { expr: Box<Expr>, index: Box<Expr>, }, MultiDimIndex { expr: Box<Expr>, indices: Vec<HirIndexComponent>, }, Tuple { elements: Vec<Expr>, }, Array { elements: Vec<Expr>, }, ArrayRepeat { element: Box<Expr>, count: u64, }, Struct { def_id: HirId, fields: Vec<FieldInit>, variant_name: Option<Symbol>, }, Block(Block), If { condition: Box<Expr>, then_block: Block, else_block: Option<Box<Expr>>, }, Match { expr: Box<Expr>, arms: Vec<MatchArm>, }, Loop { body: Block, }, While { condition: Box<Expr>, body: Block, }, For { pattern: Pattern, iter: Box<Expr>, body: Block, }, Return { value: Option<Box<Expr>>, }, Break { value: Option<Box<Expr>>, }, Continue, Assign { target: Box<Expr>, value: Box<Expr>, }, Ref { mutable: bool, expr: Box<Expr>, }, Deref { expr: Box<Expr>, }, Cast { expr: Box<Expr>, target_ty: Ty, }, Spawn { expr: Box<Expr>, }, SpawnWithDeadline { deadline: Box<Expr>, body: Block, }, TaskGroup { body: Block, }, TaskGroupAll { body: Block, }, Channel { element_ty: Ty, capacity: Box<Expr>, }, Select { arms: Vec<HirSelectArm>, }, SelectBiased { arms: Vec<HirSelectArm>, }, Gpu { body: Block, }, Distributed { body: Block, }, EnergyBudgetBlock { budget: EnergyBudgetConstraint, body: Block, }, ThermalAdapt { arms: Vec<HirThermalArm>, }, Await { expr: Box<Expr>, }, Try { expr: Box<Expr>, }, SpawnRemote { node: Box<Expr>, expr: Box<Expr>, }, Cancelled, Path { segments: Vec<Symbol>, }, Closure { params: Vec<Param>, return_ty: Ty, body: Box<Expr>, captures: Vec<Capture>, is_move: bool, }, Perform { effect_name: Symbol, operation: Symbol, args: Vec<Expr>, }, Handle { body: Block, handlers: Vec<HirEffectHandler>, }, Parallel { pattern: Pattern, iter: Box<Expr>, body: Block, }, Build { builder_ty: Ty, body: Block, },
}

Variants§

§

Literal(Literal)

Literal value

§

Var

Variable reference (resolved to definition)

Fields

§def_id: HirId
§name: Symbol
§

Binary

Binary operation

Fields

§left: Box<Expr>
§right: Box<Expr>
§

Unary

Unary operation

Fields

§op: UnOp
§expr: Box<Expr>
§

Call

Function call

Fields

§func: Box<Expr>
§args: Vec<Expr>
§

MethodCall

Method call

Fields

§receiver: Box<Expr>
§method: Symbol
§args: Vec<Expr>
§

Field

Field access

Fields

§expr: Box<Expr>
§field: Symbol
§field_idx: usize
§

Index

Index

Fields

§expr: Box<Expr>
§index: Box<Expr>
§

MultiDimIndex

Multi-dimensional index: arr[i, j], arr[1..5, ::2]

Fields

§expr: Box<Expr>
§

Tuple

Tuple

Fields

§elements: Vec<Expr>
§

Array

Array

Fields

§elements: Vec<Expr>
§

ArrayRepeat

Array repeat [value; count]

Fields

§element: Box<Expr>
§count: u64
§

Struct

Struct literal (variant_name is set for enum variant struct literals like Enum::Variant { .. })

Fields

§def_id: HirId
§fields: Vec<FieldInit>
§variant_name: Option<Symbol>
§

Block(Block)

Block

§

If

If expression

Fields

§condition: Box<Expr>
§then_block: Block
§else_block: Option<Box<Expr>>
§

Match

Match expression

Fields

§expr: Box<Expr>
§

Loop

Loop

Fields

§body: Block
§

While

While loop

Fields

§condition: Box<Expr>
§body: Block
§

For

For loop

Fields

§pattern: Pattern
§iter: Box<Expr>
§body: Block
§

Return

Return

Fields

§value: Option<Box<Expr>>
§

Break

Break

Fields

§value: Option<Box<Expr>>
§

Continue

Continue

§

Assign

Assignment

Fields

§target: Box<Expr>
§value: Box<Expr>
§

Ref

Reference &x or &mut x

Fields

§mutable: bool
§expr: Box<Expr>
§

Deref

Dereference *x

Fields

§expr: Box<Expr>
§

Cast

Type cast x as T

Fields

§expr: Box<Expr>
§target_ty: Ty
§

Spawn

Spawn a task

Fields

§expr: Box<Expr>
§

SpawnWithDeadline

Spawn with deadline

Fields

§deadline: Box<Expr>
§body: Block
§

TaskGroup

Task group (structured concurrency)

Fields

§body: Block
§

TaskGroupAll

Task group collecting all results

Fields

§body: Block
§

Channel

Channel creation

Fields

§element_ty: Ty
§capacity: Box<Expr>
§

Select

Select (random among ready)

Fields

§

SelectBiased

Biased select (first-listed priority)

Fields

§

Gpu

GPU execution block

Fields

§body: Block
§

Distributed

Distributed execution block

Fields

§body: Block
§

EnergyBudgetBlock

Energy budget block: energy_budget(max_joules = 0.001) { … }

§

ThermalAdapt

Thermal adaptation: thermal_adapt { Cool => { … }, Hot => { … } }

Fields

§

Await

Await expression: expr.await (extracts value from Future/Task)

Fields

§expr: Box<Expr>
§

Try

Try operator: expr?

Fields

§expr: Box<Expr>
§

SpawnRemote

Remote spawn

Fields

§node: Box<Expr>
§expr: Box<Expr>
§

Cancelled

Check if current task is cancelled

§

Path

Qualified path (like EnumName::VariantName)

Fields

§segments: Vec<Symbol>
§

Closure

Closure expression

Fields

§params: Vec<Param>
§return_ty: Ty
§body: Box<Expr>
§captures: Vec<Capture>
§is_move: bool
§

Perform

Perform an algebraic effect operation: perform IO::read()

Fields

§effect_name: Symbol
§operation: Symbol
§args: Vec<Expr>
§

Handle

Handle algebraic effects: handle { body } with { IO => handler }

Fields

§body: Block
§

Parallel

Parallel for loop: parallel for x in iter { body }

Fields

§pattern: Pattern
§iter: Box<Expr>
§body: Block
§

Build

Result builder expression: build TypeName { stmt1; stmt2; ... }

Fields

§builder_ty: Ty
§body: Block

Trait Implementations§

Source§

impl Clone for ExprKind

Source§

fn clone(&self) -> ExprKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ExprKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.