pub enum MojoStatement {
Function {
name: String,
params: Vec<(String, Option<String>)>,
return_type: Option<String>,
body: Vec<MojoStatement>,
},
Variable {
name: String,
ty: Option<String>,
value: Option<MojoExpression>,
is_let: bool,
},
Assignment {
target: MojoExpression,
value: MojoExpression,
},
If {
condition: MojoExpression,
then_body: Vec<MojoStatement>,
else_body: Option<Vec<MojoStatement>>,
},
While {
condition: MojoExpression,
body: Vec<MojoStatement>,
},
For {
variable: String,
iterable: MojoExpression,
body: Vec<MojoStatement>,
},
Return(Option<MojoExpression>),
Expression(MojoExpression),
}Expand description
Mojo statement types.
Variants§
Function
Function definition statement.
Fields
§
body: Vec<MojoStatement>Function body statements.
Variable
Variable declaration statement.
Fields
§
value: Option<MojoExpression>Initial value expression.
Assignment
Assignment statement.
If
If statement.
Fields
§
condition: MojoExpressionCondition expression.
§
then_body: Vec<MojoStatement>Then branch statements.
§
else_body: Option<Vec<MojoStatement>>Optional else branch statements.
While
While loop statement.
Fields
§
condition: MojoExpressionLoop condition expression.
§
body: Vec<MojoStatement>Loop body statements.
For
For loop statement.
Return(Option<MojoExpression>)
Return statement.
Expression(MojoExpression)
Expression statement.
Trait Implementations§
Source§impl Clone for MojoStatement
impl Clone for MojoStatement
Source§fn clone(&self) -> MojoStatement
fn clone(&self) -> MojoStatement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MojoStatement
impl Debug for MojoStatement
Source§impl<'de> Deserialize<'de> for MojoStatement
impl<'de> Deserialize<'de> for MojoStatement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MojoStatement
impl RefUnwindSafe for MojoStatement
impl Send for MojoStatement
impl Sync for MojoStatement
impl Unpin for MojoStatement
impl UnsafeUnpin for MojoStatement
impl UnwindSafe for MojoStatement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more