Enum HirStmt

pub enum HirStmt {
    Let {
        name: String,
        name_span: SourceSpan,
        ownership: OwnershipMode,
        mode: AssignMode,
        value: ExprId,
    },
    Assign {
        target: AssignTarget,
        mode: AssignMode,
        value: ExprId,
    },
    If {
        condition: ExprId,
        then_body: Vec<StmtId>,
        else_body: Option<Vec<StmtId>>,
    },
    For {
        binding_name: String,
        binding_name_span: SourceSpan,
        binding_is_mut_borrow: bool,
        iterable: ExprId,
        body: Vec<StmtId>,
    },
    While {
        condition: ExprId,
        body: Vec<StmtId>,
    },
    Match {
        value: ExprId,
        arms: Vec<HirMatchArm>,
    },
    Meta {
        body_len: usize,
    },
    Expr {
        expr: ExprId,
        has_semi: bool,
    },
}
Expand description

HIR statement node.

Variants§

§

Let

Binding declaration statement.

Fields

§name: String

Binding name introduced by the statement.

§name_span: SourceSpan

Source span covering the binding name token.

§ownership: OwnershipMode

Ownership mode assigned to the local binding.

§mode: AssignMode

Assignment mode used to initialize the binding.

§value: ExprId

Expression id providing the bound value.

§

Assign

Assignment to an existing binding or field path.

Fields

§target: AssignTarget

Target path being assigned into.

§mode: AssignMode

Assignment mode used to initialize the binding.

§value: ExprId

Expression id providing the bound value.

§

If

Conditional statement.

Fields

§condition: ExprId

Expression id evaluated as the condition.

§then_body: Vec<StmtId>

Statement ids in the then branch.

§else_body: Option<Vec<StmtId>>

Optional statement ids in the else branch.

§

For

Collection iteration statement.

Fields

§binding_name: String

Binding name introduced for each iteration item.

§binding_name_span: SourceSpan

Source span covering the iteration binding name token.

§binding_is_mut_borrow: bool

Whether the condition binding is a mutable borrow.

§iterable: ExprId

Expression id producing the iterable collection.

§body: Vec<StmtId>

Statement ids executed for each iteration.

§

While

Loop that repeats while a condition remains true.

Fields

§condition: ExprId

Expression id evaluated as the condition.

§body: Vec<StmtId>

Statement ids executed for each iteration.

§

Match

Enum match statement.

Fields

§value: ExprId

Expression id evaluated as match subject.

§arms: Vec<HirMatchArm>

Arms evaluated in order.

§

Meta

Meta block placeholder retained in HIR.

Fields

§body_len: usize

Number of meta statements contained in the block.

§

Expr

Standalone expression statement.

Fields

§expr: ExprId

Expression id evaluated by the statement.

§has_semi: bool

Whether the original source used a trailing semicolon.

Trait Implementations§

§

impl Clone for HirStmt

§

fn clone(&self) -> HirStmt

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

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

Performs copy-assignment from source. Read more
§

impl Debug for HirStmt

§

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

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.