Skip to main content

Receiver

Trait 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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

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§