pub enum Stmt {
Print(Expr),
Let(String, Expr),
If {
condition: Expr,
then_branch: Vec<Stmt>,
else_branch: Option<Vec<Stmt>>,
},
While {
condition: Expr,
body: Vec<Stmt>,
},
Break,
Continue,
Fn {
name: String,
params: Vec<String>,
body: Vec<Stmt>,
},
Call(String, Vec<Expr>),
Return(Expr),
}Expand description
Represents a statement in the language.
Variants§
Print(Expr)
Prints the result of an expression.
Let(String, Expr)
Declares or updates a variable.
If
Conditional execution.
While
Looping construct.
Break
Exits a loop early.
Continue
Skips to the next loop iteration.
Fn
Defines a function.
Call(String, Vec<Expr>)
Calls a function as a statement.
Return(Expr)
Returns a value from a function.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stmt
impl RefUnwindSafe for Stmt
impl Send for Stmt
impl Sync for Stmt
impl Unpin for Stmt
impl UnwindSafe for Stmt
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
Mutably borrows from an owned value. Read more