pub enum Expr {
Show 34 variants
Int(IntLit),
Float(FloatLit),
String(StringLit),
Bool(BoolLit),
Unit(UnitLit),
Ident(Ident),
Binary(BinaryExpr),
Unary(UnaryExpr),
Paren(ParenExpr),
Block(BlockExpr),
If(IfExpr),
Match(MatchExpr),
While(WhileExpr),
For(ForExpr),
Loop(LoopExpr),
Call(CallExpr),
Break(BreakExpr),
Continue(ContinueExpr),
Return(ReturnExpr),
StructLit(StructLitExpr),
Field(FieldExpr),
MethodCall(MethodCallExpr),
IntrinsicCall(IntrinsicCallExpr),
ArrayLit(ArrayLitExpr),
Index(IndexExpr),
Path(PathExpr),
EnumStructLit(EnumStructLitExpr),
AssocFnCall(AssocFnCallExpr),
SelfExpr(SelfExpr),
Comptime(ComptimeBlockExpr),
ComptimeUnrollFor(ComptimeUnrollForExpr),
Checked(CheckedBlockExpr),
TypeLit(TypeLitExpr),
Error(Span),
}Expand description
An expression.
Variants§
Int(IntLit)
Integer literal
Float(FloatLit)
Floating-point literal
String(StringLit)
String literal
Bool(BoolLit)
Boolean literal
Unit(UnitLit)
Unit literal (explicit () or implicit unit for blocks without final expression)
Ident(Ident)
Identifier reference (variable)
Binary(BinaryExpr)
Binary operation (e.g., a + b)
Unary(UnaryExpr)
Unary operation (e.g., -x)
Paren(ParenExpr)
Parenthesized expression (e.g., (a + b))
Block(BlockExpr)
Block with statements and final expression
If(IfExpr)
If expression (e.g., if cond { a } else { b })
Match(MatchExpr)
Match expression (e.g., match x { 1 => a, _ => b })
While(WhileExpr)
While expression (e.g., while cond { body })
For(ForExpr)
For-in expression (e.g., for x in arr { body })
Loop(LoopExpr)
Loop expression - infinite loop (e.g., loop { body })
Call(CallExpr)
Function call (e.g., foo(1, 2))
Break(BreakExpr)
Break statement (exits the innermost loop)
Continue(ContinueExpr)
Continue statement (skips to the next iteration of the innermost loop)
Return(ReturnExpr)
Return statement (returns a value from the current function)
StructLit(StructLitExpr)
Struct literal (e.g., Point { x: 1, y: 2 })
Field(FieldExpr)
Field access (e.g., point.x)
MethodCall(MethodCallExpr)
Method call (e.g., point.distance())
IntrinsicCall(IntrinsicCallExpr)
Intrinsic call (e.g., @dbg(42))
ArrayLit(ArrayLitExpr)
Array literal (e.g., [1, 2, 3])
Index(IndexExpr)
Array indexing (e.g., arr[0])
Path(PathExpr)
Path expression (e.g., Color::Red)
EnumStructLit(EnumStructLitExpr)
Enum struct variant literal (e.g., Shape::Circle { radius: 5 })
AssocFnCall(AssocFnCallExpr)
Associated function call (e.g., Point::origin())
SelfExpr(SelfExpr)
Self expression (e.g., self in method bodies)
Comptime(ComptimeBlockExpr)
Comptime block expression (e.g., comptime { 1 + 2 })
ComptimeUnrollFor(ComptimeUnrollForExpr)
Comptime unroll for expression (e.g., comptime_unroll for field in info.fields { ... })
Checked(CheckedBlockExpr)
Checked block expression (e.g., checked { @ptr_read(p) })
TypeLit(TypeLitExpr)
Type literal expression (e.g., i32 used as a value in generic function calls)
Error(Span)
Error node for recovered parse errors. Used by error recovery to continue parsing after a syntax error.
Implementations§
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].