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: 376 bytes
Size for each variant:
Assembly
: 128 bytesBlock
: 48 bytesBreak
: 16 bytesContinue
: 16 bytesDoWhile
: 176 bytesEmit
: 152 bytesExpr
: 152 bytesFor
: 376 bytesIf
: 184 bytesReturn
: 152 bytesRevert
: 152 bytesTry
: 136 bytesUncheckedBlock
: 56 bytesVarDecl
: 336 bytesWhile
: 168 bytes