[][src]Struct session_types::Chan

#[must_use]
pub struct Chan<E, P>(_, _, _);

A session typed channel. P is the protocol and E is the environment, containing potential recursion targets

Methods

impl<E> Chan<E, Eps>[src]

pub fn close(self)[src]

Close a channel. Should always be used at the end of your program.

impl<E, P, A: Send + 'static> Chan<E, Send<A, P>>[src]

#[must_use]
pub fn send(self, v: A) -> Chan<E, P>
[src]

Send a value of type A over the channel. Returns a channel with protocol P

impl<E, P, A: Send + 'static> Chan<E, Recv<A, P>>[src]

#[must_use]
pub fn recv(self) -> (Chan<E, P>, A)
[src]

Receives a value of type A from the channel. Returns a tuple containing the resulting channel and the received value.

#[must_use]
pub fn try_recv(self) -> Result<(Chan<E, P>, A), Self>
[src]

Non-blocking receive.

impl<E, P, Q> Chan<E, Choose<P, Q>>[src]

#[must_use]
pub fn sel1(self) -> Chan<E, P>
[src]

Perform an active choice, selecting protocol P.

#[must_use]
pub fn sel2(self) -> Chan<E, Q>
[src]

Perform an active choice, selecting protocol Q.

impl<Z, A, B> Chan<Z, Choose<A, B>>[src]

Convenience function. This is identical to .sel2()

#[must_use]
pub fn skip(self) -> Chan<Z, B>
[src]

impl<Z, A, B, C> Chan<Z, Choose<A, Choose<B, C>>>[src]

Convenience function. This is identical to .sel2().sel2()

#[must_use]
pub fn skip2(self) -> Chan<Z, C>
[src]

impl<Z, A, B, C, D> Chan<Z, Choose<A, Choose<B, Choose<C, D>>>>[src]

Convenience function. This is identical to .sel2().sel2().sel2()

#[must_use]
pub fn skip3(self) -> Chan<Z, D>
[src]

impl<Z, A, B, C, D, E> Chan<Z, Choose<A, Choose<B, Choose<C, Choose<D, E>>>>>[src]

Convenience function. This is identical to .sel2().sel2().sel2().sel2()

#[must_use]
pub fn skip4(self) -> Chan<Z, E>
[src]

impl<Z, A, B, C, D, E, F> Chan<Z, Choose<A, Choose<B, Choose<C, Choose<D, Choose<E, F>>>>>>[src]

Convenience function. This is identical to .sel2().sel2().sel2().sel2().sel2()

#[must_use]
pub fn skip5(self) -> Chan<Z, F>
[src]

impl<Z, A, B, C, D, E, F, G> Chan<Z, Choose<A, Choose<B, Choose<C, Choose<D, Choose<E, Choose<F, G>>>>>>>[src]

Convenience function.

#[must_use]
pub fn skip6(self) -> Chan<Z, G>
[src]

impl<Z, A, B, C, D, E, F, G, H> Chan<Z, Choose<A, Choose<B, Choose<C, Choose<D, Choose<E, Choose<F, Choose<G, H>>>>>>>>[src]

Convenience function.

#[must_use]
pub fn skip7(self) -> Chan<Z, H>
[src]

impl<E, P, Q> Chan<E, Offer<P, Q>>[src]

#[must_use]
pub fn offer(self) -> Branch<Chan<E, P>, Chan<E, Q>>
[src]

Passive choice. This allows the other end of the channel to select one of two options for continuing the protocol: either P or Q.

#[must_use]
pub fn try_offer(self) -> Result<Branch<Chan<E, P>, Chan<E, Q>>, Self>
[src]

Poll for choice.

impl<E, P> Chan<E, Rec<P>>[src]

#[must_use]
pub fn enter(self) -> Chan<(P, E), P>
[src]

Enter a recursive environment, putting the current environment on the top of the environment stack.

impl<E, P> Chan<(P, E), Var<Z>>[src]

#[must_use]
pub fn zero(self) -> Chan<(P, E), P>
[src]

Recurse to the environment on the top of the environment stack.

impl<E, P, N> Chan<(P, E), Var<S<N>>>[src]

#[must_use]
pub fn succ(self) -> Chan<E, Var<N>>
[src]

Pop the top environment from the environment stack.

Trait Implementations

impl<E, P> Drop for Chan<E, P>[src]

impl<E: Send, P: Send> Send for Chan<E, P>[src]

Auto Trait Implementations

impl<E, P> !Sync for Chan<E, P>

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.