pub enum Statement {
FunctionDef {
name: String,
parameters: Vec<Parameter>,
return_type: Option<Type>,
body: Vec<Statement>,
},
VariableDecl {
is_mutable: bool,
name: String,
type_annotation: Option<Type>,
value: Option<Expression>,
},
Expression(Expression),
Return(Option<Expression>),
If {
test: Expression,
body: Vec<Statement>,
orelse: Option<Vec<Statement>>,
},
While {
test: Expression,
body: Vec<Statement>,
},
For {
variable: String,
iterable: Expression,
body: Vec<Statement>,
},
Block(Vec<Statement>),
}Expand description
Statement
Variants§
FunctionDef
Function definition
Fields
VariableDecl
Variable declaration
Fields
§
value: Option<Expression>The initial value of the variable.
Expression(Expression)
Expression statement
Return(Option<Expression>)
Return statement
If
Conditional statement
Fields
§
test: ExpressionThe condition expression.
While
While loop
Fields
§
test: ExpressionThe loop condition expression.
For
For loop
Fields
§
iterable: ExpressionThe iterable expression.
Block(Vec<Statement>)
Block
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Statement
impl<'de> Deserialize<'de> for Statement
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
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statement
impl UnwindSafe for Statement
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