Enum rhai::Stmt [−][src]
pub enum Stmt {}Show variants
Noop(Position), If(Expr, Box<(StmtBlock, StmtBlock)>, Position), Switch(Expr, Box<(BTreeMap<u64, Box<(Option<Expr>, StmtBlock)>>, StmtBlock)>, Position), While(Expr, Box<StmtBlock>, Position), Do(Box<StmtBlock>, Expr, bool, Position), For(Expr, Box<(Ident, StmtBlock)>, Position), Let(Expr, Box<Ident>, bool, Position), Const(Expr, Box<Ident>, bool, Position), Assignment(Box<(Expr, Option<OpAssignment>, Expr)>, Position), FnCall(Box<FnCallExpr>, Position), Block(Box<[Stmt]>, Position), TryCatch(Box<(StmtBlock, Option<Ident>, StmtBlock)>, Position, Position), Expr(Expr), Continue(Position), Break(Position), Return(ReturnType, Option<Expr>, Position), Import(Expr, Option<Box<Ident>>, Position), Export(Box<[(Ident, Option<Ident>)]>, Position), Share(Identifier),
Expand description
(INTERNALS) A statement.
Exported under the internals
feature only.
Volatile Data Structure
This type is volatile and may change.
Variants
Noop(Position)
No-op.
if
expr {
stmt }
else
{
stmt }
switch
expr if
condition {
literal or _ =>
stmt ,
… }
while
expr {
stmt }
do
{
stmt }
while
|until
expr
for
id in
expr {
stmt }
[export
] let
id =
expr
[export
] const
id =
expr
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.
{
stmt;
… }
try
{
stmt; … }
catch
(
var )
{
stmt; … }
Expr(Expr)
Continue(Position)
continue
Break(Position)
break
Return(ReturnType, Option<Expr>, Position)
return
/throw
import
expr as
var
Not available under no_module
.
export
var as
var ,
…
Not available under no_module
.
Convert a variable to shared.
Not available under no_closure
.
Implementations
impl Stmt
[src]
impl Stmt
[src]pub fn set_position(&mut self, new_pos: Position) -> &mut Self
[src]
pub fn set_position(&mut self, new_pos: Position) -> &mut Self
[src]Override the position of this statement.
pub fn returns_value(&self) -> bool
[src]
pub fn returns_value(&self) -> bool
[src]Does this statement return a value?
pub fn is_self_terminated(&self) -> bool
[src]
pub fn is_self_terminated(&self) -> bool
[src]Is this statement self-terminated (i.e. no need for a semicolon terminator)?
pub fn is_internally_pure(&self) -> bool
[src]
pub fn is_internally_pure(&self) -> bool
[src]Is this statement pure within the containing block?
An internally pure statement only has side effects that disappear outside the block.
Only variable declarations (i.e. let
and const
) and import
/export
statements
are internally pure.
pub fn is_control_flow_break(&self) -> bool
[src]
pub fn is_control_flow_break(&self) -> bool
[src]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 !Send for Stmt
impl !Sync for Stmt
impl Unpin for Stmt
impl !UnwindSafe for Stmt
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more