Enum rhai::Stmt[][src]

pub enum Stmt {
Show 15 variants Noop(Position), IfThenElse(Box<(Expr, Stmt, Option<Stmt>, Position)>), While(Box<(Expr, Stmt, Position)>), Loop(Box<(Stmt, Position)>), For(Box<(String, Expr, Stmt, Position)>), Let(Box<((String, Position), Option<Expr>, Position)>), Const(Box<((String, Position), Option<Expr>, Position)>), Block(Box<(StaticVec<Stmt>, Position)>), Expr(Box<Expr>), Continue(Position), Break(Position), ReturnWithVal(Box<((ReturnType, Position), Option<Expr>, Position)>), Import(Box<(Expr, Option<(ImmutableString, Position)>, Position)>), Export(Box<(StaticVec<((String, Position), Option<(String, Position)>)>, Position)>), Share(Box<(String, Position)>),
}
Expand description

[INTERNALS] A Rhai statement. Exported under the internals feature only.

Each variant is at most one pointer in size (for speed), with everything being allocated together in one single tuple.

Variants

Noop(Position)

Tuple Fields

No-op.

IfThenElse(Box<(Expr, Stmt, Option<Stmt>, Position)>)

Tuple Fields

if expr { stmt } else { stmt }

While(Box<(Expr, Stmt, Position)>)

Tuple Fields

while expr { stmt }

Loop(Box<(Stmt, Position)>)

Tuple Fields

loop { stmt }

For(Box<(String, Expr, Stmt, Position)>)

Tuple Fields

for id in expr { stmt }

Let(Box<((String, Position), Option<Expr>, Position)>)

Tuple Fields

let id = expr

Const(Box<((String, Position), Option<Expr>, Position)>)

Tuple Fields

const id = expr

Block(Box<(StaticVec<Stmt>, Position)>)

Tuple Fields

{ stmt; … }

Expr(Box<Expr>)

Tuple Fields

0: Box<Expr>

expr

Continue(Position)

Tuple Fields

continue

Break(Position)

Tuple Fields

break

ReturnWithVal(Box<((ReturnType, Position), Option<Expr>, Position)>)

return/throw

Import(Box<(Expr, Option<(ImmutableString, Position)>, Position)>)

import expr as module

Export(Box<(StaticVec<((String, Position), Option<(String, Position)>)>, Position)>)

expr id as name, …

Share(Box<(String, Position)>)

Tuple Fields

Convert a variable to shared.

Implementations

Get the Position of this statement.

Override the Position of this statement.

Is this statement self-terminated (i.e. no need for a semicolon terminator)?

Is this statement pure?

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

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)

recently added

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.