Ir

Enum Ir 

Source
pub enum Ir {
    Recv(Type),
    Send(Type),
    Call(Option<Index>),
    Choose(Vec<Option<Index>>),
    Offer(Vec<Option<Index>>),
    Split {
        tx_only: Option<Index>,
        rx_only: Option<Index>,
    },
    Loop(Option<Index>),
    Break(Index),
    Continue(Index),
    Type(Type),
    Error,
}
Expand description

The “kind” of a CFG node. CFG nodes have additional data stored in CfgNode which is always the same types and fields for every node, so we separate into the Ir variant and CfgNode wrapper/entry struct.

Variants§

§

Recv(Type)

Indicating receiving a value of some type.

§

Send(Type)

Indicating sending a value of some type.

§

Call(Option<Index>)

Call nodes act somewhat like a call/cc, and run their body continuation in the same scope as they are called all the way to “Done” before running their own continuation.

§

Choose(Vec<Option<Index>>)

Choose nodes have a list of continuations which supersede their “next” pointer. Before scope resolution, these continuations may be extended by their “implicit” subsequent continuation, which is stored in the “next” pointer of the node. The scope resolution pass “lowers” this next pointer continuation into the arms of the Choose, and so after scope resolution all Choose nodes’ next pointers should be None.

§

Offer(Vec<Option<Index>>)

Like Choose, Offer nodes have a list of choices, and after scope resolution have no continuation.

§

Split

Split nodes have a transmit-only half and a receive-only half. The nodes’ semantics are similar to Call.

Fields

§tx_only: Option<Index>

The transmit-only half.

§rx_only: Option<Index>

The receive-only half.

§

Loop(Option<Index>)

Early on, loops may have a body; however, after scope resolution, all loops should have their bodies be Some. So post scope resolution, this field may be unwrapped.

§

Break(Index)

Break nodes directly reference the loop that they break. They can be considered as a direct reference to the “next” pointer of the referenced loop node.

§

Continue(Index)

Like break nodes, Continue nodes directly reference the loop that they continue. Semantically they can be considered a reference to the body of the loop, but as they are a special construct in the target language, we don’t resolve them that way.

§

Type(Type)

A “directly injected” type.

§

Error

Emitted when we need to have a node to put errors on but need to not reason about its behavior.

Trait Implementations§

Source§

impl Clone for Ir

Source§

fn clone(&self) -> Ir

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 Ir

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Ir

§

impl RefUnwindSafe for Ir

§

impl !Send for Ir

§

impl !Sync for Ir

§

impl Unpin for Ir

§

impl UnwindSafe for Ir

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.