pub enum SwiftStmt {
Show 16 variants
Let {
name: String,
ty: Option<SwiftType>,
value: SwiftExpr,
},
Var {
name: String,
ty: Option<SwiftType>,
value: Option<SwiftExpr>,
},
Assign {
target: SwiftExpr,
value: SwiftExpr,
},
Return(Option<SwiftExpr>),
If {
cond: SwiftExpr,
then_body: Vec<SwiftStmt>,
else_body: Vec<SwiftStmt>,
},
IfLet {
name: String,
value: SwiftExpr,
then_body: Vec<SwiftStmt>,
else_body: Vec<SwiftStmt>,
},
Guard {
cond: SwiftExpr,
else_body: Vec<SwiftStmt>,
},
Switch {
subject: SwiftExpr,
cases: Vec<SwiftCase>,
},
For {
name: String,
collection: SwiftExpr,
body: Vec<SwiftStmt>,
},
While {
cond: SwiftExpr,
body: Vec<SwiftStmt>,
},
Throw(SwiftExpr),
Break,
Continue,
ExprStmt(SwiftExpr),
Block(Vec<SwiftStmt>),
Raw(String),
}Expand description
Swift statement for code generation.
Variants§
Let
let name: Type = expr
Var
var name: Type = expr
Assign
target = expr
Return(Option<SwiftExpr>)
return expr?
If
if cond { then } else { else }
IfLet
if let name = expr { ... } else { ... }
Guard
guard cond else { ... }
Switch
switch subject { case ... }
For
for name in collection { body }
While
while cond { body }
Throw(SwiftExpr)
throw expr
Break
break
Continue
continue
ExprStmt(SwiftExpr)
Bare expression statement
Block(Vec<SwiftStmt>)
A raw block of statements: { stmts }
Raw(String)
A raw string inserted verbatim (for runtime preamble, etc.)
Trait Implementations§
impl StructuralPartialEq for SwiftStmt
Auto Trait Implementations§
impl Freeze for SwiftStmt
impl RefUnwindSafe for SwiftStmt
impl Send for SwiftStmt
impl Sync for SwiftStmt
impl Unpin for SwiftStmt
impl UnsafeUnpin for SwiftStmt
impl UnwindSafe for SwiftStmt
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