pub enum Stmt {
Expr(MaybeExpr),
Assign(MaybeExpr, AssignOp, MaybeExpr),
If(MaybeExpr, Brace, MaybeElse),
While(MaybeExpr, Brace, MaybeElse),
For(MaybeExpr, Brace, MaybeElse),
Switch(MaybeExpr, Vec<Case>, MaybeElse),
Verb(Verb, MaybeExpr),
}Expand description
Represents a statement, including the trailing ; if any.
Stmts frequently contain Exprs, and never two consecutively. We allow
every such Expr to be optional, so that a later pass can report a helpful
error when it’s missing.
Variants§
Expr(MaybeExpr)
E.g. print("Hello");.
Assign(MaybeExpr, AssignOp, MaybeExpr)
E.g. x += 1;.
If(MaybeExpr, Brace, MaybeElse)
E.g. if ... {...} else {...}.
Allow the condition Expr to be None, though it’s an error.
While(MaybeExpr, Brace, MaybeElse)
E.g. while ... {...} else {...}.
Allow the condition Expr to be None, though it’s an error.
For(MaybeExpr, Brace, MaybeElse)
E.g. for ... in ... {...} else {...}.
Allow an arbitrary Expr, or a missing one, though anything but
... in ... is an error.
Switch(MaybeExpr, Vec<Case>, MaybeElse)
E.g. switch ... case ... {...} case ... {...} else {...}.
Allow the discriminant Expr to be None, though it’s an error.
Verb(Verb, MaybeExpr)
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