Trait TcpHandler

Source
pub trait TcpHandler {
    // Required methods
    fn handler_send<'life0, 'life1, 'async_trait, B>(
        &'life0 mut self,
        message: &'life1 mut B,
    ) -> Pin<Box<dyn Future<Output = Result<(), PacketError>> + Send + 'async_trait>>
       where B: 'async_trait + Buf + Send,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn handler_recv<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<BytesMut, PacketError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn handler_send_recv<'life0, 'life1, 'async_trait, B>(
        &'life0 mut self,
        message: &'life1 mut B,
    ) -> Pin<Box<dyn Future<Output = Result<BytesMut, PacketError>> + Send + 'async_trait>>
       where B: 'async_trait + Buf + Send,
             Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Available on crate feature streams only.
Expand description

The handler trait, providing send and receive methods.

This trait uses [async_trait] so the parameters require Send mark.

Required Methods§

Source

fn handler_send<'life0, 'life1, 'async_trait, B>( &'life0 mut self, message: &'life1 mut B, ) -> Pin<Box<dyn Future<Output = Result<(), PacketError>> + Send + 'async_trait>>
where B: 'async_trait + Buf + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message to the remote.

Source

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

Receive a message from the remote.

Provided Methods§

Source

fn handler_send_recv<'life0, 'life1, 'async_trait, B>( &'life0 mut self, message: &'life1 mut B, ) -> Pin<Box<dyn Future<Output = Result<BytesMut, PacketError>> + Send + 'async_trait>>
where B: 'async_trait + Buf + Send, Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send and receive a message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerCompress<R, W>

Available on crate feature compression only.
Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerCompress<R, W>

Available on crate feature compression only.
Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerCompressEncrypt<R, W>

Available on crate feature compress_encryption only.
Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerCompressEncrypt<R, W>

Available on crate feature compress_encryption only.
Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerEncrypt<R, W>

Available on crate feature encryption only.
Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerEncrypt<R, W>

Available on crate feature encryption only.
Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerRaw<R, W>

Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerRaw<R, W>