Struct tcp_handler::streams::compress::TcpServerHandlerCompress
source · pub struct TcpServerHandlerCompress<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> { /* private fields */ }
Available on crate features
streams
and compression
only.Expand description
The server side TcpHandler
of the compress
protocol.
Implementations§
source§impl<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> TcpServerHandlerCompress<R, W>
impl<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> TcpServerHandlerCompress<R, W>
sourcepub async fn new<P: FnOnce(&str) -> bool>(
reader: R,
writer: W,
identifier: &str,
version_prediction: P,
version: &str
) -> Result<Self, StarterError>
pub async fn new<P: FnOnce(&str) -> bool>( reader: R, writer: W, identifier: &str, version_prediction: P, version: &str ) -> Result<Self, StarterError>
Create and init a new TcpServerHandlerCompress
.
sourcepub fn into_inner(self) -> (R, W)
pub fn into_inner(self) -> (R, W)
Deconstruct the TcpServerHandlerCompress
into the inner parts.
sourcepub fn from_inner(reader: R, writer: W, version: String) -> Self
pub fn from_inner(reader: R, writer: W, version: String) -> Self
Unsafe!!!
Construct the TcpServerHandlerCompress
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 client.
sourcepub async fn recv(&mut self) -> Result<BytesMut, PacketError>
pub async fn recv(&mut self) -> Result<BytesMut, PacketError>
Receive a message from the client.
source§impl<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> TcpServerHandlerCompress<R, W>
impl<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> TcpServerHandlerCompress<R, W>
sourcepub fn get_client_version(&self) -> &str
pub fn get_client_version(&self) -> &str
Get the client’s application version.
source§impl TcpServerHandlerCompress<BufReader<OwnedReadHalf>, BufWriter<OwnedWriteHalf>>
impl TcpServerHandlerCompress<BufReader<OwnedReadHalf>, BufWriter<OwnedWriteHalf>>
sourcepub async fn from_stream<P: FnOnce(&str) -> bool>(
stream: TcpStream,
identifier: &str,
version_prediction: P,
version: &str
) -> Result<Self, StarterError>
Available on crate feature stream_net
only.
pub async fn from_stream<P: FnOnce(&str) -> bool>( stream: TcpStream, identifier: &str, version_prediction: P, version: &str ) -> Result<Self, StarterError>
stream_net
only.Construct the TcpServerHandlerCompress
from tokio::net::TcpStream
.
Trait Implementations§
source§impl<R: Debug + AsyncRead + Unpin, W: Debug + AsyncWrite + Unpin> Debug for TcpServerHandlerCompress<R, W>
impl<R: Debug + AsyncRead + Unpin, W: Debug + AsyncWrite + Unpin> Debug for TcpServerHandlerCompress<R, W>
source§impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerCompress<R, W>
impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerCompress<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 TcpServerHandlerCompress<R, W>
impl<R, W> RefUnwindSafe for TcpServerHandlerCompress<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for TcpServerHandlerCompress<R, W>
impl<R, W> Sync for TcpServerHandlerCompress<R, W>
impl<R, W> Unpin for TcpServerHandlerCompress<R, W>
impl<R, W> UnwindSafe for TcpServerHandlerCompress<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