Enum quad_compat_rhai::Stmt[][src]

pub enum Stmt {
Show 17 variants Noop(Position), If(ExprBox<(StmtBlock, StmtBlock)>, Position), Switch(ExprBox<(BTreeMap<u64, Box<(Option<Expr>, StmtBlock)>>, StmtBlock, StaticVec<(INT, INT, bool, Option<Expr>, StmtBlock)>)>, Position), While(ExprBox<StmtBlock>, Position), Do(Box<StmtBlock>, ExprOptionFlagsPosition), For(ExprBox<(Ident, Option<Ident>, StmtBlock)>, Position), Var(ExprBox<Ident>, OptionFlagsPosition), 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(OptionFlagsPosition), Return(OptionFlagsOption<Expr>, Position), Import(ExprOption<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

No-op.

If(ExprBox<(StmtBlock, StmtBlock)>, Position)

Tuple Fields

0: Expr

if expr { stmt } else { stmt }

Switch(ExprBox<(BTreeMap<u64, Box<(Option<Expr>, StmtBlock)>>, StmtBlock, StaticVec<(INT, INT, bool, Option<Expr>, StmtBlock)>)>, Position)

switch expr if condition { literal or _ => stmt ,}

While(ExprBox<StmtBlock>, Position)

Tuple Fields

0: Expr

while expr { stmt } | loop { stmt }

If the guard expression is UNIT, then it is a loop statement.

Do(Box<StmtBlock>, ExprOptionFlagsPosition)

Tuple Fields

1: Expr

do { stmt } while|until expr

Option Flags

For(ExprBox<(Ident, Option<Ident>, StmtBlock)>, Position)

Tuple Fields

0: Expr

for ( id , counter ) in expr { stmt }

Var(ExprBox<Ident>, OptionFlagsPosition)

Tuple Fields

0: Expr
1: Box<Ident>

[export] let|const id = expr

Option Flags

Assignment(Box<(Expr, Option<OpAssignment<'static>>, Expr)>, Position)

Tuple Fields

0: Box<(Expr, Option<OpAssignment<'static>>, Expr)>

expr op= expr

FnCall(Box<FnCallExpr>, Position)

Tuple Fields

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)

Tuple Fields

0: Box<[Stmt]>

{ stmt;}

TryCatch(Box<(StmtBlock, Option<Ident>, StmtBlock)>, Position)

Tuple Fields

try { stmt; … } catch ( var ) { stmt; … }

Expr(Expr)

Tuple Fields

0: Expr

BreakLoop(OptionFlagsPosition)

Tuple Fields

continue/break

Option Flags

Return(OptionFlagsOption<Expr>, Position)

Tuple Fields

return/throw

Option Flags

Import(ExprOption<Box<Ident>>, Position)

Tuple Fields

0: Expr

import expr as var

Not available under no_module.

Export(Box<[(Ident, Ident)]>, Position)

Tuple Fields

export var as var ,

Not available under no_module.

Share(Identifier)

Tuple Fields

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

Is this statement Noop?

Get the position of this statement.

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?

A pure statement has no side effects.

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.

Recursively walk this statement. Return false from the callback to terminate the walk.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.