[][src]Struct session_types::ChanSelect

pub struct ChanSelect<'c> { /* fields omitted */ }

Heterogeneous selection structure for channels

This builds a structure of channels that we wish to select over. This is structured in a way such that the channels selected over cannot be interacted with (consumed) as long as the borrowing ChanSelect object exists. This is necessary to ensure memory safety.

The type parameter T is a return type, ie we store a value of some type T that is returned in case its associated channels is selected on wait()

Methods

impl<'c> ChanSelect<'c>[src]

pub fn new() -> ChanSelect<'c>[src]

pub fn add_recv<E, P, A: Send>(&mut self, chan: &'c Chan<E, Recv<A, P>>)[src]

Add a channel whose next step is Recv

Once a channel has been added it cannot be interacted with as long as it is borrowed here (by virtue of borrow checking and lifetimes).

pub fn add_offer<E, P, Q>(&mut self, chan: &'c Chan<E, Offer<P, Q>>)[src]

pub fn wait(self) -> usize[src]

Find a Receiver (and hence a Chan) that is ready to receive.

This method consumes the ChanSelect, freeing up the borrowed Receivers to be consumed.

pub fn len(&self) -> usize[src]

How many channels are there in the structure?

Auto Trait Implementations

impl<'c> !Send for ChanSelect<'c>

impl<'c> !Sync for ChanSelect<'c>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.