[−][src]Struct session_types::ChanSelect
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]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,