[][src]Enum rhai::Stmt

pub enum Stmt {
    Noop(Position),
    If(ExprBox<(Stmt, Option<Stmt>)>, Position),
    Switch(ExprBox<(HashMap<u64, Stmt, StraightHasherBuilder>, Option<Stmt>)>, Position),
    While(ExprBox<Stmt>, Position),
    Do(Box<Stmt>, ExprboolPosition),
    For(ExprBox<(String, Stmt)>, Position),
    Let(Box<Ident>, Option<Expr>, boolPosition),
    Const(Box<Ident>, Option<Expr>, boolPosition),
    Assignment(Box<(Expr, Cow<'static, str>, Expr)>, Position),
    Block(Vec<Stmt>, Position),
    TryCatch(Box<(Stmt, Option<Ident>, Stmt)>, PositionPosition),
    Expr(Expr),
    Continue(Position),
    Break(Position),
    Return((ReturnType, Position)Option<Expr>, Position),
    Import(ExprOption<Box<IdentX>>, Position),
    Export(Vec<(IdentX, Option<IdentX>)>, Position),
    Share(IdentX),
}

(INTERNALS) A statement. Exported under the internals feature only.

WARNING

This type is volatile and may change.

Variants

Noop(Position)

No-op.

if expr { stmt } else { stmt }

Switch(ExprBox<(HashMap<u64, Stmt, StraightHasherBuilder>, Option<Stmt>)>, Position)

switch expr { literal or _ => stmt , ... }

While(ExprBox<Stmt>, Position)

while expr { stmt }

do { stmt } while|until expr

for id in expr { stmt }

[export] let id = expr

Const(Box<Ident>, Option<Expr>, boolPosition)

[export] const id = expr

Assignment(Box<(Expr, Cow<'static, str>, Expr)>, Position)

expr op= expr

Block(Vec<Stmt>, Position)

{ stmt; ... }

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

Expr(Expr)
Continue(Position)

continue

Break(Position)

break

return/throw

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

import expr as var

export var as var , ...

Share(IdentX)

Convert a variable to shared.

Implementations

impl Stmt[src]

pub fn is_noop(&self) -> bool[src]

Is this statement Noop?

pub fn position(&self) -> Position[src]

Get the position of this statement.

pub fn set_position(&mut self, new_pos: Position) -> &mut Self

Notable traits for &'_ mut W

impl<'_, W> Write for &'_ mut W where
    W: Write + ?Sized
impl<'_, R> Read for &'_ mut R where
    R: Read + ?Sized
impl<'_, F> Future for &'_ mut F where
    F: Unpin + Future + ?Sized
type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Override the position of this statement.

pub fn is_self_terminated(&self) -> bool[src]

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

pub fn is_pure(&self) -> bool[src]

Is this statement pure?

A pure statement has no side effects.

Trait Implementations

impl Clone for Stmt[src]

impl Debug for Stmt[src]

impl Default for Stmt[src]

Auto Trait Implementations

impl !RefUnwindSafe for Stmt

impl !Send for Stmt

impl !Sync for Stmt

impl Unpin for Stmt

impl !UnwindSafe for Stmt

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.