Module dialectic::backend[][src]

The interface implemented by all transport backends for a Chan.

A Chan<S, Tx, Rx> is parameterized by its transmitting channel Tx and its receiving channel Rx. In order to use a Chan to run a session, these underlying channels must implement the traits Transmitter and Receiver, as well as Transmit<T> and Receive<T> for at least the types T used in those capacities in any given session.

Functions which are generic over their backend will in turn need to specify the bounds Transmit<T> and Receive<T> for all Ts they send and receive, respectively. The Transmitter and Receiver attribute macros make this bound specification succinct; see their documentation for more details.

Re-exports

pub use call_by::By;
pub use call_by::Convention;
pub use call_by::Mut;
pub use call_by::Ref;
pub use call_by::Val;

Structs

Choice

A Choice represents a selection between several protocols offered by offer!.

OutOfBoundsChoiceError

When attempting to construct a Choice<N> via try_into or try_from, this error is thrown when the choice exceeds the type-level strict upper bound N.

Traits

Receive

If a transport is Receive<T>, we can use it to recv a message of type T.

Receiver

A backend transport used for receiving (i.e. the Rx parameter of Chan) must implement Receiver, which specifies what type of errors it might return, as well as giving a method to send Choices across the channel. This is a super-trait of Receive, which is what’s actually needed to receive particular values over a Chan.

Transmit

If a transport is Transmit<T, C>, we can use it to send a message of type T by Val, Ref, or Mut, depending on the calling convention specified by C.

Transmitter

A backend transport used for transmitting (i.e. the Tx parameter of Chan) must implement Transmitter, which specifies what type of errors it might return, as well as giving a method to send Choices across the channel. This is a super-trait of Transmit, which is what’s actually needed to receive particular values over a Chan.