pub enum Stmt {
Show 15 variants
Assembly(StmtAssembly),
Block(Block),
Break(StmtBreak),
Continue(StmtContinue),
DoWhile(StmtDoWhile),
Emit(StmtEmit),
Expr(StmtExpr),
For(StmtFor),
If(StmtIf),
Return(StmtReturn),
Revert(StmtRevert),
Try(StmtTry),
UncheckedBlock(UncheckedBlock),
VarDecl(StmtVarDecl),
While(StmtWhile),
}
Expand description
A statement, usually ending in a semicolon.
Solidity reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.statement
Variants§
Assembly(StmtAssembly)
An assembly block, with optional flags: assembly "evmasm" { ... }
.
Block(Block)
A blocked scope: { ... }
.
Break(StmtBreak)
A break statement: break;
.
Continue(StmtContinue)
A continue statement: continue;
.
DoWhile(StmtDoWhile)
A do-while statement: do { ... } while (condition);
.
Emit(StmtEmit)
An emit statement: emit FooBar(42);
.
Expr(StmtExpr)
An expression with a trailing semicolon.
For(StmtFor)
A for statement: for (uint256 i; i < 42; ++i) { ... }
.
If(StmtIf)
An if
statement with an optional else
block: if (expr) { ... } else { ... }
.
Return(StmtReturn)
A return statement: return 42;
.
Revert(StmtRevert)
A revert statement: revert("error");
.
Try(StmtTry)
A try statement: try fooBar(42) catch { ... }
.
UncheckedBlock(UncheckedBlock)
An unchecked block: unchecked { ... }
.
VarDecl(StmtVarDecl)
A variable declaration statement: uint256 foo = 42;
.
While(StmtWhile)
A while statement: while (i < 42) { ... }
.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 244 bytes
Size for each variant:
Assembly
: 72 bytesBlock
: 28 bytesBreak
: 12 bytesContinue
: 12 bytesDoWhile
: 124 bytesEmit
: 104 bytesExpr
: 100 bytesFor
: 244 bytesIf
: 124 bytesReturn
: 104 bytesRevert
: 104 bytesTry
: 80 bytesUncheckedBlock
: 32 bytesVarDecl
: 216 bytesWhile
: 116 bytes