Enum Expr

pub(in elab) enum Expr {
Show 18 variants Ident { name: String, span: SourceSpan, }, Int(i64), Number(NumberLiteral), String(String), Bool(bool), Array { items: Vec<Expr>, span: SourceSpan, }, Tuple { items: Vec<Expr>, span: SourceSpan, }, StructLit { name: String, fields: Vec<NamedExprField>, span: SourceSpan, }, Call { callee: Box<Expr>, args: Vec<CallArg>, span: SourceSpan, }, IntrinsicCall { name: String, args: Vec<CallArg>, span: SourceSpan, }, Field { base: Box<Expr>, field: String, }, Index { base: Box<Expr>, index: Box<Expr>, }, SliceRange { base: Box<Expr>, start: Option<Box<Expr>>, end: Option<Box<Expr>>, }, Prefix { op: PrefixOp, value: Box<Expr>, }, Binary { op: BinaryOp, lhs: Box<Expr>, rhs: Box<Expr>, }, Relational { op: RelationalOp, lhs: Box<Expr>, rhs: Box<Expr>, }, Block(Block), Splice(Box<MetaExpr>),
}
Expand description

Runtime expression.

Variants§

§

Ident

Meta identifier reference.

Fields

§name: String

Identifier text as written in source.

§span: SourceSpan

Source span covering the identifier token.

§

Int(i64)

Legacy integer literal.

§

Number(NumberLiteral)

Numeric literal.

§

String(String)

String literal.

§

Bool(bool)

Boolean literal.

§

Array

Array literal expression.

Fields

§items: Vec<Expr>

Elements included in source order.

§span: SourceSpan

Source span covering the full literal.

§

Tuple

Tuple literal expression.

Fields

§items: Vec<Expr>

Elements included in source order.

§span: SourceSpan

Source span covering the full literal.

§

StructLit

Struct literal expression.

Fields

§name: String

Struct constructor name being instantiated.

§fields: Vec<NamedExprField>

Field values supplied for the literal.

§span: SourceSpan

Source span covering the full literal.

§

Call

Function call expression.

Fields

§callee: Box<Expr>

Callee expression to invoke.

§args: Vec<CallArg>

Positional call arguments.

§span: SourceSpan

Source span covering the full call.

§

IntrinsicCall

Builtin intrinsic call expression.

Fields

§name: String

Binding name introduced by the statement.

§args: Vec<CallArg>

Positional call arguments.

§span: SourceSpan

Source span covering the full intrinsic call.

§

Field

Field projection expression.

Fields

§base: Box<Expr>

Base expression being projected from.

§field: String

Field name being accessed.

§

Index

Collection indexing expression.

Fields

§base: Box<Expr>

Base expression being projected from.

§index: Box<Expr>

Index expression selecting an element.

§

SliceRange

Slice-range expression over an array or slice.

Fields

§base: Box<Expr>

Base expression being projected from.

§start: Option<Box<Expr>>

Optional inclusive start bound.

§end: Option<Box<Expr>>

Optional exclusive end bound.

§

Prefix

Prefix operator expression.

Fields

§op: PrefixOp

Prefix operator to apply.

§value: Box<Expr>

Operand expression.

§

Binary

Binary operator expression.

Fields

§op: BinaryOp

Binary operator to apply.

§lhs: Box<Expr>

Left-hand operand.

§rhs: Box<Expr>

Right-hand operand.

§

Relational

Relational operator expression.

Fields

§op: RelationalOp

Relational operator to apply.

§lhs: Box<Expr>

Left-hand operand.

§rhs: Box<Expr>

Right-hand operand.

§

Block(Block)

Nested block expression.

§

Splice(Box<MetaExpr>)

Meta splice inside quoted code.

Trait Implementations§

§

impl Clone for Expr

§

fn clone(&self) -> Expr

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 Expr

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for Expr

§

fn eq(&self, other: &Expr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for Expr

§

impl StructuralPartialEq for Expr

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnwindSafe for Expr

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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.