Struct TcpServerHandlerCompressEncrypt

Source
pub struct TcpServerHandlerCompressEncrypt<R: AsyncRead + Unpin, W: AsyncWrite + Unpin> { /* private fields */ }
Available on crate features streams and compress_encryption only.
Expand description

The server side TcpHandler of the compress_encrypt protocol.

Implementations§

Source§

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

Source

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 TcpServerHandlerCompressEncrypt.

Source

pub fn into_inner(self) -> (R, W, Cipher)

Deconstruct the TcpServerHandlerCompressEncrypt into the inner parts.

Source

pub fn from_inner(reader: R, writer: W, cipher: Cipher, version: String) -> Self

Unsafe!!! Construct the TcpServerHandlerCompressEncrypt from the inner parts.

Source

pub async fn send<B: Buf>(&mut self, message: &mut B) -> Result<(), PacketError>

Send a message to the client.

Source

pub async fn recv(&mut self) -> Result<BytesMut, PacketError>

Receive a message from the client.

Source§

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

Source

pub fn get_client_version(&self) -> &str

Get the client’s application version.

Source§

impl TcpServerHandlerCompressEncrypt<BufReader<OwnedReadHalf>, BufWriter<OwnedWriteHalf>>

Source

pub 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.

Construct the TcpServerHandlerCompressEncrypt from tokio::net::TcpStream.

Trait Implementations§

Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: AsyncRead + Unpin + Send, W: AsyncWrite + Unpin + Send> TcpHandler for TcpServerHandlerCompressEncrypt<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>>
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.
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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V