Enum quad_compat_rhai::Stmt [−][src]
pub enum Stmt {
Show 17 variants
Noop(Position),
If(Expr, Box<(StmtBlock, StmtBlock)>, Position),
Switch(Expr, Box<(BTreeMap<u64, Box<(Option<Expr>, StmtBlock)>>, StmtBlock, StaticVec<(INT, INT, bool, Option<Expr>, StmtBlock)>)>, Position),
While(Expr, Box<StmtBlock>, Position),
Do(Box<StmtBlock>, Expr, OptionFlags, Position),
For(Expr, Box<(Ident, Option<Ident>, StmtBlock)>, Position),
Var(Expr, Box<Ident>, OptionFlags, Position),
Assignment(Box<(Expr, Option<OpAssignment<'static>>, Expr)>, Position),
FnCall(Box<FnCallExpr>, Position),
Block(Box<[Stmt]>, Position),
TryCatch(Box<(StmtBlock, Option<Ident>, StmtBlock)>, Position),
Expr(Expr),
BreakLoop(OptionFlags, Position),
Return(OptionFlags, Option<Expr>, Position),
Import(Expr, Option<Box<Ident>>, Position),
Export(Box<[(Ident, Ident)]>, Position),
Share(Identifier),
}
Expand description
(internals) A statement.
Exported under the internals
feature only.
Variants
Noop(Position)
Tuple Fields
0: Position
No-op.
If(Expr, Box<(StmtBlock, StmtBlock)>, Position)
if
expr {
stmt }
else
{
stmt }
Switch(Expr, Box<(BTreeMap<u64, Box<(Option<Expr>, StmtBlock)>>, StmtBlock, StaticVec<(INT, INT, bool, Option<Expr>, StmtBlock)>)>, Position)
Tuple Fields
0: Expr
1: Box<(BTreeMap<u64, Box<(Option<Expr>, StmtBlock)>>, StmtBlock, StaticVec<(INT, INT, bool, Option<Expr>, StmtBlock)>)>
2: Position
switch
expr if
condition {
literal or _ =>
stmt ,
… }
While(Expr, Box<StmtBlock>, Position)
while
expr {
stmt }
| loop
{
stmt }
If the guard expression is UNIT
, then it is a loop
statement.
Do(Box<StmtBlock>, Expr, OptionFlags, Position)
For(Expr, Box<(Ident, Option<Ident>, StmtBlock)>, Position)
for
(
id ,
counter )
in
expr {
stmt }
Var(Expr, Box<Ident>, OptionFlags, Position)
Assignment(Box<(Expr, Option<OpAssignment<'static>>, Expr)>, Position)
expr op=
expr
FnCall(Box<FnCallExpr>, Position)
func (
expr ,
… )
Note - this is a duplicate of Expr::FnCall
to cover the very common pattern of a single
function call forming one statement.
Block(Box<[Stmt]>, Position)
{
stmt;
… }
TryCatch(Box<(StmtBlock, Option<Ident>, StmtBlock)>, Position)
try
{
stmt; … }
catch
(
var )
{
stmt; … }
Expr(Expr)
Tuple Fields
0: Expr
BreakLoop(OptionFlags, Position)
Return(OptionFlags, Option<Expr>, Position)
Import(Expr, Option<Box<Ident>>, Position)
import
expr as
var
Not available under no_module
.
Export(Box<[(Ident, Ident)]>, Position)
export
var as
var ,
…
Not available under no_module
.
Share(Identifier)
Convert a variable to shared.
Not available under no_closure
.
Notes
This variant does not map to any language structure. It is currently only used only to convert a normal variable into a shared variable when the variable is captured by a closure.
Implementations
Override the position of this statement.
Does this statement return a value?
Is this statement self-terminated (i.e. no need for a semicolon terminator)?
Is this statement pure within the containing block?
An internally pure statement only has side effects that disappear outside the block.
Currently only variable definitions (i.e. let
and const
) and import
/export
statements are internally pure.
Does this statement break the current control flow through the containing block?
Currently this is only true for return
, throw
, break
and continue
.
All statements following this statement will essentially be dead code.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Stmt
impl !UnwindSafe for Stmt
Blanket Implementations
Mutably borrows from an owned value. Read more