Enum HirExpr

pub enum HirExpr {
Show 17 variants Ident { name: String, span: SourceSpan, }, Number(NumberLiteral), String(String), Bool(bool), Array(Vec<ExprId>), Tuple(Vec<ExprId>), StructLit { name: String, fields: Vec<(String, ExprId)>, }, Call { callee: ExprId, args: Vec<ExprId>, }, IntrinsicCall { intrinsic: IntrinsicId, type_args: Vec<TypeExpr>, args: Vec<ExprId>, }, Field { base: ExprId, field: String, }, Index { base: ExprId, index: ExprId, }, SliceRange { base: ExprId, start: Option<ExprId>, end: Option<ExprId>, }, Prefix { op: PrefixOp, value: ExprId, }, Binary { op: BinaryOp, lhs: ExprId, rhs: ExprId, }, Relational { op: RelationalOp, lhs: ExprId, rhs: ExprId, }, Block { body: Vec<StmtId>, }, SpliceMeta { value: String, },
}
Expand description

HIR expression node.

Variants§

§

Ident

Identifier reference expression.

Fields

§name: String

Identifier text as written in source.

§span: SourceSpan

Source span covering the identifier token.

§

Number(NumberLiteral)

Numeric literal expression.

§

String(String)

String literal expression.

§

Bool(bool)

Boolean literal expression.

§

Array(Vec<ExprId>)

Array literal expression.

§

Tuple(Vec<ExprId>)

Tuple literal expression.

§

StructLit

Struct literal expression.

Fields

§name: String

Binding name introduced by the statement.

§fields: Vec<(String, ExprId)>

Field expressions keyed by field name.

§

Call

Function call expression.

Fields

§callee: ExprId

Expression id naming the callee.

§args: Vec<ExprId>

Positional argument expression ids.

§

IntrinsicCall

Builtin intrinsic call expression.

Fields

§intrinsic: IntrinsicId

Builtin intrinsic identifier.

§type_args: Vec<TypeExpr>

Optional explicit type arguments passed to the intrinsic.

§args: Vec<ExprId>

Positional argument expression ids.

§

Field

Field projection expression.

Fields

§base: ExprId

Base expression being projected from.

§field: String

Field name being accessed.

§

Index

Collection indexing expression.

Fields

§base: ExprId

Base expression being projected from.

§index: ExprId

Expression id for the index value.

§

SliceRange

Slice-range expression over an array or slice.

Fields

§base: ExprId

Base expression being projected from.

§start: Option<ExprId>

Optional start bound expression id.

§end: Option<ExprId>

Optional end bound expression id.

§

Prefix

Prefix operator expression.

Fields

§op: PrefixOp

Prefix operator to apply.

§value: ExprId

Expression id providing the bound value.

§

Binary

Binary operator expression.

Fields

§op: BinaryOp

Binary operator to apply.

§lhs: ExprId

Left-hand operand expression id.

§rhs: ExprId

Right-hand operand expression id.

§

Relational

Relational comparison expression.

Fields

§op: RelationalOp

Relational operator to apply.

§lhs: ExprId

Left-hand operand expression id.

§rhs: ExprId

Right-hand operand expression id.

§

Block

Nested block expression.

Fields

§body: Vec<StmtId>

Statement ids executed for each iteration.

§

SpliceMeta

Meta splice placeholder retained in HIR.

Fields

§value: String

Serialized meta value carried by the splice.

Trait Implementations§

§

impl Clone for HirExpr

§

fn clone(&self) -> HirExpr

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 HirExpr

§

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.