Trait 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: Error + Send + Sync + 'static;
    type ReceiveError: Error + 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: Error + Send + Sync + 'static

Error of outgoing delivery channel

Source

type ReceiveError: Error + 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: Error + Send + Sync + 'static, OErr: Error + Send + Sync + 'static,

Source§

type Send = O

Source§

type Receive = I

Source§

type SendError = OErr

Source§

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 features sim-async and sim only.