Terminator

Enum Terminator 

Source
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)

Fields

§span: Span
§

Goto

Unconditional jump

Fields

§span: Span
§

SwitchInt

Conditional branch

Fields

§discriminant: Operand

The discriminant to switch on

§targets: SwitchTargets

Possible targets

§span: Span
§

Call

Function call

Fields

§func: Operand

The function to call

§func_name: Option<Symbol>

Name of the function (for built-ins and external functions)

§args: Vec<Operand>

Arguments

§destination: Place

Where to store the return value

§target: BasicBlockId

Block to jump to after call

§is_virtual: bool

Whether this is a virtual dispatch call on a trait object

§span: Span
§

Abort

Panic/abort

Fields

§span: Span
§

Unreachable

Unreachable code

Fields

§span: Span
§

Spawn

Spawn a new task The spawned function runs concurrently and returns a TaskHandle

Fields

§func: Operand

The function/closure to spawn

§args: Vec<Operand>

Arguments to the function

§destination: Place

Where to store the task handle

§target: BasicBlockId

Block to continue in after spawn

§span: Span
§

TaskAwait

Await a task handle to get its result Blocks until the task completes

Fields

§task: Operand

Task handle to await

§destination: Place

Where to store the result

§target: BasicBlockId

Block to continue in after await

§span: Span
§

TaskGroupEnter

Enter a task group (structured concurrency) Creates a new scope where child tasks must complete

Fields

§destination: Place

Where to store the task group handle

§body: BasicBlockId

Block to continue in (the task group body)

§join_block: BasicBlockId

Block to jump to after all tasks complete

§span: Span
§

TaskGroupExit

Exit a task group, waiting for all spawned tasks

Fields

§group: Operand

The task group handle

§target: BasicBlockId

Block to continue in after all tasks complete

§span: Span
§

ChannelRecv

Blocking receive from a channel Suspends the current task until a value is available

Fields

§channel: Operand

Channel to receive from

§destination: Place

Where to store the received value

§target: BasicBlockId

Block to continue in after receive

§closed_target: BasicBlockId

Block to jump to if channel is closed

§span: Span
§

ChannelSend

Blocking send to a channel Suspends the current task if the channel is full

Fields

§channel: Operand

Channel to send to

§value: Operand

Value to send

§target: BasicBlockId

Block to continue in after send

§closed_target: BasicBlockId

Block to jump to if channel is closed

§span: Span
§

Select

Select on multiple channel operations Waits for one of the operations to become ready

Fields

§arms: Vec<SelectArm>

Arms to select from

§default: Option<BasicBlockId>

Default block (if all operations would block and there’s a default)

§destination: Place

Where to store the received value (if any)

§selected_arm: Place

Where to store which arm was selected (index)

§span: Span
§

Cancel

Cancel the current task

Fields

§span: Span

Trait Implementations§

Source§

impl Clone for Terminator

Source§

fn clone(&self) -> Terminator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Terminator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.