pub struct TcpClientHandlerCompressEncrypt<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> { /* private fields */ }
Available on crate features
streams
and compress_encryption
only.Expand description
The client side TcpHandler
of the compress_encrypt
protocol.
Implementations§
Source§impl<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> TcpClientHandlerCompressEncrypt<R, W>
impl<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> TcpClientHandlerCompressEncrypt<R, W>
Sourcepub async fn new(
reader: R,
writer: W,
identifier: &str,
version: &str,
) -> Result<Self, StarterError>
pub async fn new( reader: R, writer: W, identifier: &str, version: &str, ) -> Result<Self, StarterError>
Create and init a new TcpClientHandlerCompressEncrypt
.
Sourcepub fn into_inner(self) -> (R, W, Cipher)
pub fn into_inner(self) -> (R, W, Cipher)
Deconstruct the TcpClientHandlerCompressEncrypt
into the inner parts.
Sourcepub fn from_inner(reader: R, writer: W, cipher: Cipher) -> Self
pub fn from_inner(reader: R, writer: W, cipher: Cipher) -> Self
Unsafe!!!
Construct the TcpClientHandlerCompressEncrypt
from the inner parts.
Sourcepub async fn send<B: Buf>(&mut self, message: &mut B) -> Result<(), PacketError>
pub async fn send<B: Buf>(&mut self, message: &mut B) -> Result<(), PacketError>
Send a message to the server.
Sourcepub async fn recv(&mut self) -> Result<BytesMut, PacketError>
pub async fn recv(&mut self) -> Result<BytesMut, PacketError>
Receive a message from the server.
Source§impl TcpClientHandlerCompressEncrypt<BufReader<OwnedReadHalf>, BufWriter<OwnedWriteHalf>>
impl TcpClientHandlerCompressEncrypt<BufReader<OwnedReadHalf>, BufWriter<OwnedWriteHalf>>
Sourcepub async fn connect<A: ToSocketAddrs>(
addr: A,
identifier: &str,
version: &str,
) -> Result<Self, StarterError>
Available on crate feature stream_net
only.
pub async fn connect<A: ToSocketAddrs>( addr: A, identifier: &str, version: &str, ) -> Result<Self, StarterError>
stream_net
only.Connection to addr
, and construct the TcpClientHandlerCompressEncrypt
using TcpClientHandlerCompressEncrypt::new
.
Source§impl TcpClientHandlerCompressEncrypt<BufReader<OwnedReadHalf>, BufWriter<OwnedWriteHalf>>
impl TcpClientHandlerCompressEncrypt<BufReader<OwnedReadHalf>, BufWriter<OwnedWriteHalf>>
Sourcepub async fn from_stream(
stream: TcpStream,
identifier: &str,
version: &str,
) -> Result<Self, StarterError>
Available on crate feature stream_net
only.
pub async fn from_stream( stream: TcpStream, identifier: &str, version: &str, ) -> Result<Self, StarterError>
stream_net
only.Construct the TcpClientHandlerCompressEncrypt
from tokio::net::TcpStream
.
Trait Implementations§
Source§impl<R: Debug + AsyncRead + Unpin, W: Debug + AsyncWrite + Unpin> Debug for TcpClientHandlerCompressEncrypt<R, W>
impl<R: Debug + AsyncRead + Unpin, W: Debug + AsyncWrite + Unpin> Debug for TcpClientHandlerCompressEncrypt<R, W>
Source§impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerCompressEncrypt<R, W>
impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpClientHandlerCompressEncrypt<R, W>
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>>
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.
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,
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.
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>>
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.
Auto Trait Implementations§
impl<R, W> !Freeze for TcpClientHandlerCompressEncrypt<R, W>
impl<R, W> RefUnwindSafe for TcpClientHandlerCompressEncrypt<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for TcpClientHandlerCompressEncrypt<R, W>
impl<R, W> Sync for TcpClientHandlerCompressEncrypt<R, W>
impl<R, W> Unpin for TcpClientHandlerCompressEncrypt<R, W>
impl<R, W> UnwindSafe for TcpClientHandlerCompressEncrypt<R, W>where
R: UnwindSafe,
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more