Trait round_based::Delivery

source ·
pub trait Delivery<M> {
    type Send: Sink<Outgoing<M>, Error = Self::SendError> + Unpin;
    type Receive: Stream<Item = Result<Incoming<M>, Self::ReceiveError>> + Unpin;
    type SendError: StdError + Send + Sync + 'static;
    type ReceiveError: StdError + Send + Sync + 'static;

    // Required method
    fn split(self) -> (Self::Receive, Self::Send);
}
Expand description

Networking abstraction

Basically, it’s pair of channels: Stream for receiving messages, and Sink for sending messages to other parties.

Required Associated Types§

source

type Send: Sink<Outgoing<M>, Error = Self::SendError> + Unpin

Outgoing delivery channel

source

type Receive: Stream<Item = Result<Incoming<M>, Self::ReceiveError>> + Unpin

Incoming delivery channel

source

type SendError: StdError + Send + Sync + 'static

Error of outgoing delivery channel

source

type ReceiveError: StdError + Send + Sync + 'static

Error of incoming delivery channel

Required Methods§

source

fn split(self) -> (Self::Receive, Self::Send)

Returns a pair of incoming and outgoing delivery channels

Implementations on Foreign Types§

source§

impl<M, I, O, IErr, OErr> Delivery<M> for (I, O)
where I: Stream<Item = Result<Incoming<M>, IErr>> + Unpin, O: Sink<Outgoing<M>, Error = OErr> + Unpin, IErr: StdError + Send + Sync + 'static, OErr: StdError + Send + Sync + 'static,

§

type Send = O

§

type Receive = I

§

type SendError = OErr

§

type ReceiveError = IErr

source§

fn split(self) -> (Self::Receive, Self::Send)

Implementors§

source§

impl<M> Delivery<M> for MockedDelivery<M>
where M: Clone + Send + Unpin + 'static,

Available on crate feature dev only.