pub enum MetalStmt {
VarDecl {
ty: MetalType,
name: String,
init: Option<MetalExpr>,
is_const: bool,
},
Assign {
lhs: MetalExpr,
rhs: MetalExpr,
},
CompoundAssign {
lhs: MetalExpr,
op: MetalBinOp,
rhs: MetalExpr,
},
IfElse {
cond: MetalExpr,
then_body: Vec<MetalStmt>,
else_body: Option<Vec<MetalStmt>>,
},
ForLoop {
init: Box<MetalStmt>,
cond: MetalExpr,
step: MetalExpr,
body: Vec<MetalStmt>,
},
WhileLoop {
cond: MetalExpr,
body: Vec<MetalStmt>,
},
Return(Option<MetalExpr>),
Expr(MetalExpr),
Barrier(MemFlags),
Block(Vec<MetalStmt>),
Break,
Continue,
}Expand description
Metal Shading Language statement AST node.
Variants§
VarDecl
Variable declaration with optional initializer: T name [ = init ];
Fields
Assign
Simple assignment: lhs = rhs;
CompoundAssign
Compound assignment: lhs += rhs; etc.
IfElse
If / optional else
ForLoop
C-style for loop
WhileLoop
While loop
Return(Option<MetalExpr>)
return [expr];
Expr(MetalExpr)
Raw expression statement: expr;
Barrier(MemFlags)
threadgroup_barrier(flags);
Block(Vec<MetalStmt>)
Block of statements: { ... }
Break
break;
Continue
continue;
Trait Implementations§
impl StructuralPartialEq for MetalStmt
Auto Trait Implementations§
impl Freeze for MetalStmt
impl RefUnwindSafe for MetalStmt
impl Send for MetalStmt
impl Sync for MetalStmt
impl Unpin for MetalStmt
impl UnsafeUnpin for MetalStmt
impl UnwindSafe for MetalStmt
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