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§
Sourcefn handler_send<'life0, 'life1, 'async_trait, B>(
&'life0 mut self,
message: &'life1 mut B,
) -> Pin<Box<dyn Future<Output = Result<(), PacketError>> + Send + 'async_trait>>
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>>
Send a message to the remote.
Sourcefn 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,
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§
Sourcefn 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>>
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>>
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§
impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerCompress<R, W>
Available on crate feature
compression
only.impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerCompress<R, W>
Available on crate feature
compression
only.impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerCompressEncrypt<R, W>
Available on crate feature
compress_encryption
only.impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerCompressEncrypt<R, W>
Available on crate feature
compress_encryption
only.impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerEncrypt<R, W>
Available on crate feature
encryption
only.impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerEncrypt<R, W>
Available on crate feature
encryption
only.