Struct nemo::Chan [] [src]

pub struct Chan<'a, I: 'a, E: SessionType, S: SessionType>(_, _);

Channels are provided to handlers to act as a "courier" for the session type and a guard for the IO backend.

Methods

impl<'a, I, E: SessionType, S: SessionType> Chan<'a, I, E, S>
[src]

fn defer<P: Handler<I, E, S>>(self) -> Defer<P, I>

Defer the rest of the protocol execution. Useful for returning early.

There must be a Handler implemented for the protocol state you're deferring.

impl<'a, I: IO<usize>, E: SessionType> Chan<'a, I, E, End>
[src]

fn close<P: Protocol>(self) -> Defer<P, I>

Close the channel. Only possible if it's in the End state.

impl<'a, I: IO<A>, A, E: SessionType, S: SessionType> Chan<'a, I, E, Send<A, S>>
[src]

fn send(self, a: A) -> Chan<'a, I, E, S>

Send an A to IO.

impl<'a, I: IO<A>, A, E: SessionType, S: SessionType> Chan<'a, I, E, Recv<A, S>>
[src]

fn recv(self) -> Result<(A, Chan<'a, I, E, S>), Self>

Receive an A from IO.

impl<'a, I, E: SessionType, S: SessionType> Chan<'a, I, E, Nest<S>>
[src]

fn enter(self) -> Chan<'a, I, (S, E), S>

Enter into a nested protocol.

impl<'a, I, N: Peano, E: SessionType + Pop<N>> Chan<'a, I, E, Escape<N>>
[src]

fn pop(self) -> Chan<'a, I, E::Tail, E::Head>

Escape from a nested protocol.

impl<'a, I: IO<usize>, E: SessionType, P: SessionType> Chan<'a, I, E, P>
[src]

fn choose<S: SessionType>(self) -> Chan<'a, I, E, S> where P: Chooser<S>

Select a protocol to advance to.

impl<'a, I: IO<usize>, E: SessionType, S: SessionType, Q: SessionType> Chan<'a, I, E, Accept<S, Q>>
[src]

fn accept<P: Protocol + Handler<I, E, Accept<S, Q>> + Acceptor<I, E, Accept<S, Q>>>(self) -> Defer<P, I>

Accept one of many protocols and advance to its handler.