pub enum ControlFlow {
IfElse {
cond: Variable,
then: NodeIndex,
or_else: NodeIndex,
merge: Option<NodeIndex>,
},
Switch {
value: Variable,
default: NodeIndex,
branches: Vec<(u32, NodeIndex)>,
merge: Option<NodeIndex>,
},
Loop {
body: NodeIndex,
continue_target: NodeIndex,
merge: NodeIndex,
},
LoopBreak {
break_cond: Variable,
body: NodeIndex,
continue_target: NodeIndex,
merge: NodeIndex,
},
Return,
None,
}Expand description
Control flow that terminates a block
Variants§
IfElse
An if or if-else branch that should be structured if applicable.
Switch
A switch branch that paths based on value
Loop
A loop with a header (the block that contains this variant), a body and a continue target.
merge is the block that gets executed as soon as the loop terminates.
LoopBreak
A loop with a header (the block that contains this variant), a body and a continue target.
merge is the block that gets executed as soon as the loop terminates. The header contains
the break condition.
Return
A return statement. This should only occur once in the program and all other returns should instead branch to this single return block.
None
No special control flow. The block must have exactly one edge that should be followed.
Trait Implementations§
Source§impl Clone for ControlFlow
impl Clone for ControlFlow
Source§fn clone(&self) -> ControlFlow
fn clone(&self) -> ControlFlow
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 ControlFlow
impl Debug for ControlFlow
Source§impl Default for ControlFlow
impl Default for ControlFlow
Source§fn default() -> ControlFlow
fn default() -> ControlFlow
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ControlFlow
impl RefUnwindSafe for ControlFlow
impl Send for ControlFlow
impl Sync for ControlFlow
impl Unpin for ControlFlow
impl UnwindSafe for ControlFlow
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