pub enum Statement {
SingleStatement(Expression),
AssignStatement(Identifier, Expression),
IndexAssignStatement {
table: Expression,
index: Expression,
value: Expression,
},
ReturnStatement(Option<Expression>),
WhileStatement {
condition: Expression,
body: Vec<Statement>,
},
IfStatement {
condition: Expression,
body: Vec<Statement>,
else_body: Option<Vec<Statement>>,
},
}
Expand description
Statement in a function
Variants
SingleStatement(Expression)
AssignStatement(Identifier, Expression)
IndexAssignStatement
Fields
table: Expression
Destination container to put value
into
index: Expression
Index or key into table
value: Expression
Expression to assign from
ReturnStatement(Option<Expression>)
WhileStatement
Fields
condition: Expression
Conditional expression to determine if iteration should continue
IfStatement
Fields
condition: Expression
Conditional expression to determine if the if
clause should run
If (else) statement
If statements can have zero or more elseif
clauses after the if
clause and an
optional else clause at the end.
Example:
if x >= 5 then
f(x)
end
or
if x == 9 then
f(x)
elseif x == 7 then
g(x)
elseif x <= 0 then
h(0)
else
h(x)
end
Trait Implementations
impl StructuralPartialEq for Statement
Auto Trait Implementations
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more