Struct Chan

Source
pub struct Chan<E, P>(/* private fields */);
Expand description

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

Implementations§

Source§

impl<E> Chan<E, Eps>

Source

pub fn close(self)

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

Source§

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

Source

pub fn send(self, v: A) -> Chan<E, P>

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

Source§

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

Source

pub fn recv(self) -> (Chan<E, P>, A)

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

Source

pub fn try_recv(self) -> Result<(Chan<E, P>, A), Self>

Non-blocking receive.

Source§

impl<E, P, Q> Chan<E, Choose<P, Q>>

Source

pub fn sel1(self) -> Chan<E, P>

Perform an active choice, selecting protocol P.

Source

pub fn sel2(self) -> Chan<E, Q>

Perform an active choice, selecting protocol Q.

Source§

impl<Z, A, B> Chan<Z, Choose<A, B>>

Convenience function. This is identical to .sel2()

Source

pub fn skip(self) -> Chan<Z, B>

Source§

impl<Z, A, B, C> Chan<Z, Choose<A, Choose<B, C>>>

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

Source

pub fn skip2(self) -> Chan<Z, C>

Source§

impl<Z, A, B, C, D> Chan<Z, Choose<A, Choose<B, Choose<C, D>>>>

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

Source

pub fn skip3(self) -> Chan<Z, D>

Source§

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

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

Source

pub fn skip4(self) -> Chan<Z, E>

Source§

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

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

Source

pub fn skip5(self) -> Chan<Z, F>

Source§

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

Convenience function.

Source

pub fn skip6(self) -> Chan<Z, G>

Source§

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>>>>>>>>

Convenience function.

Source

pub fn skip7(self) -> Chan<Z, H>

Source§

impl<E, P, Q> Chan<E, Offer<P, Q>>

Source

pub fn offer(self) -> Branch<Chan<E, P>, Chan<E, Q>>

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

Source

pub fn try_offer(self) -> Result<Branch<Chan<E, P>, Chan<E, Q>>, Self>

Poll for choice.

Source§

impl<E, P> Chan<E, Rec<P>>

Source

pub fn enter(self) -> Chan<(P, E), P>

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

Source§

impl<E, P> Chan<(P, E), Var<Z>>

Source

pub fn zero(self) -> Chan<(P, E), P>

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

Source§

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

Source

pub fn succ(self) -> Chan<E, Var<N>>

Pop the top environment from the environment stack.

Trait Implementations§

Source§

impl<E, P> Drop for Chan<E, P>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<E: Send, P: Send> Send for Chan<E, P>

Auto Trait Implementations§

§

impl<E, P> Freeze for Chan<E, P>

§

impl<E, P> RefUnwindSafe for Chan<E, P>

§

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

§

impl<E, P> Unpin for Chan<E, P>
where E: Unpin, P: Unpin,

§

impl<E, P> UnwindSafe for Chan<E, P>
where E: UnwindSafe, P: UnwindSafe,

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> 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, 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.