pub enum Terminator {
Show 14 variants
Return {
span: Span,
},
Goto {
target: BasicBlockId,
span: Span,
},
SwitchInt {
discriminant: Operand,
targets: SwitchTargets,
span: Span,
},
Call {
func: Operand,
func_name: Option<Symbol>,
args: Vec<Operand>,
destination: Place,
target: BasicBlockId,
is_virtual: bool,
span: Span,
},
Abort {
span: Span,
},
Unreachable {
span: Span,
},
Spawn {
func: Operand,
args: Vec<Operand>,
destination: Place,
target: BasicBlockId,
span: Span,
},
TaskAwait {
task: Operand,
destination: Place,
target: BasicBlockId,
span: Span,
},
TaskGroupEnter {
destination: Place,
body: BasicBlockId,
join_block: BasicBlockId,
span: Span,
},
TaskGroupExit {
group: Operand,
target: BasicBlockId,
span: Span,
},
ChannelRecv {
channel: Operand,
destination: Place,
target: BasicBlockId,
closed_target: BasicBlockId,
span: Span,
},
ChannelSend {
channel: Operand,
value: Operand,
target: BasicBlockId,
closed_target: BasicBlockId,
span: Span,
},
Select {
arms: Vec<SelectArm>,
default: Option<BasicBlockId>,
destination: Place,
selected_arm: Place,
span: Span,
},
Cancel {
span: Span,
},
}Expand description
Terminator - ends a basic block and determines control flow
Variants§
Return
Return from function (using Local::RETURN)
Goto
Unconditional jump
SwitchInt
Conditional branch
Fields
targets: SwitchTargetsPossible targets
Call
Function call
Fields
target: BasicBlockIdBlock to jump to after call
Abort
Panic/abort
Unreachable
Unreachable code
Spawn
Spawn a new task
The spawned function runs concurrently and returns a TaskHandle
Fields
target: BasicBlockIdBlock to continue in after spawn
TaskAwait
Await a task handle to get its result Blocks until the task completes
Fields
target: BasicBlockIdBlock to continue in after await
TaskGroupEnter
Enter a task group (structured concurrency) Creates a new scope where child tasks must complete
Fields
body: BasicBlockIdBlock to continue in (the task group body)
join_block: BasicBlockIdBlock to jump to after all tasks complete
TaskGroupExit
Exit a task group, waiting for all spawned tasks
Fields
target: BasicBlockIdBlock to continue in after all tasks complete
ChannelRecv
Blocking receive from a channel Suspends the current task until a value is available
Fields
target: BasicBlockIdBlock to continue in after receive
closed_target: BasicBlockIdBlock to jump to if channel is closed
ChannelSend
Blocking send to a channel Suspends the current task if the channel is full
Fields
target: BasicBlockIdBlock to continue in after send
closed_target: BasicBlockIdBlock to jump to if channel is closed
Select
Select on multiple channel operations Waits for one of the operations to become ready
Fields
default: Option<BasicBlockId>Default block (if all operations would block and there’s a default)
Cancel
Cancel the current task
Trait Implementations§
Source§impl Clone for Terminator
impl Clone for Terminator
Source§fn clone(&self) -> Terminator
fn clone(&self) -> Terminator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more