Trait request_response::network::Receiver

source ·
pub trait Receiver:
    Send
    + Sync
    + 'static {
    // Required method
    fn receive_message<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The Receiver trait is used to allow the [RequestResponseProtocol] to receive messages from a network or other source.

Required Methods§

source

fn receive_message<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receive a message. Returning an error here means the receiver will NEVER receive any more messages

Implementations on Foreign Types§

source§

impl Receiver for Receiver<Bytes>

An implementation of the Receiver trait for the [mpsc::Receiver] type. Allows us to send messages to a channel and have the protocol receive them.

source§

fn receive_message<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§