pub struct CraftConnection<R, W> { /* private fields */ }Implementations§
Source§impl<R, W> CraftConnection<R, W>
impl<R, W> CraftConnection<R, W>
pub fn into_split(self) -> (CraftReader<R>, CraftWriter<W>)
pub fn split(&mut self) -> (&mut CraftReader<R>, &mut CraftWriter<W>)
Source§impl CraftConnection<BufReader<TcpStream>, TcpStream>
impl CraftConnection<BufReader<TcpStream>, TcpStream>
pub fn connect_server_std<A>(to: A) -> Result<Self, Error>where
A: ToSocketAddrs,
pub fn wrap_client_stream_std(stream: TcpStream) -> Result<Self, Error>
pub fn from_std( s1: TcpStream, read_direction: PacketDirection, ) -> Result<Self, Error>
pub fn from_std_with_state( s1: TcpStream, read_direction: PacketDirection, state: State, ) -> Result<Self, Error>
Source§impl CraftConnection<BufReader<OwnedReadHalf>, OwnedWriteHalf>
impl CraftConnection<BufReader<OwnedReadHalf>, OwnedWriteHalf>
pub async fn connect_server_tokio<A>(to: A) -> Result<Self, TokioIoError>where
A: TokioToSocketAddrs,
Source§impl CraftConnection<OwnedReadHalf, OwnedWriteHalf>
impl CraftConnection<OwnedReadHalf, OwnedWriteHalf>
pub async fn connect_server_tokio_unbuffered<A>(
to: A,
) -> Result<Self, TokioIoError>where
A: TokioToSocketAddrs,
Source§impl<R, W> CraftConnection<R, W>
impl<R, W> CraftConnection<R, W>
pub fn from_async(tuple: (R, W), read_direction: PacketDirection) -> Self
pub fn from_async_with_state( tuple: (R, W), read_direction: PacketDirection, state: State, ) -> Self
Trait Implementations§
Source§impl<R, W> CraftAsyncReader for CraftConnection<R, W>where
CraftReader<R>: CraftAsyncReader,
R: Send + Sync,
CraftWriter<W>: CraftAsyncWriter,
W: Send + Sync,
impl<R, W> CraftAsyncReader for CraftConnection<R, W>where
CraftReader<R>: CraftAsyncReader,
R: Send + Sync,
CraftWriter<W>: CraftAsyncWriter,
W: Send + Sync,
fn read_packet_async<'a, 'async_trait, P>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = ReadResult<<P as RawPacket<'a>>::Packet>> + Send + 'async_trait>>where
P: RawPacket<'a> + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
fn read_raw_packet_async<'a, 'async_trait, P>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = ReadResult<P>> + Send + 'async_trait>>where
P: RawPacket<'a> + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
fn read_raw_untyped_packet_async<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ReadResult<(Id, &[u8])>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl<R, W> CraftAsyncWriter for CraftConnection<R, W>where
CraftReader<R>: CraftAsyncReader,
R: Send + Sync,
CraftWriter<W>: CraftAsyncWriter,
W: Send + Sync,
impl<R, W> CraftAsyncWriter for CraftConnection<R, W>where
CraftReader<R>: CraftAsyncReader,
R: Send + Sync,
CraftWriter<W>: CraftAsyncWriter,
W: Send + Sync,
Source§fn write_packet_async<'life0, 'async_trait, P>(
&'life0 mut self,
packet: P,
) -> Pin<Box<dyn Future<Output = WriteResult<()>> + Send + 'async_trait>>
fn write_packet_async<'life0, 'async_trait, P>( &'life0 mut self, packet: P, ) -> Pin<Box<dyn Future<Output = WriteResult<()>> + Send + 'async_trait>>
Attempts to serialize, and then write a packet struct to the wrapped stream.
Source§fn write_raw_packet_async<'a, 'life0, 'async_trait, P>(
&'life0 mut self,
packet: P,
) -> Pin<Box<dyn Future<Output = WriteResult<()>> + Send + 'async_trait>>
fn write_raw_packet_async<'a, 'life0, 'async_trait, P>( &'life0 mut self, packet: P, ) -> Pin<Box<dyn Future<Output = WriteResult<()>> + Send + 'async_trait>>
Attempts to write a serialized packet to the wrapped stream. Read more
Source§impl<R, W> CraftIo for CraftConnection<R, W>
impl<R, W> CraftIo for CraftConnection<R, W>
Source§fn set_state(&mut self, next: State)
fn set_state(&mut self, next: State)
Changes the current connection state. For readers, this changes how numeric packet IDs are
interpreted. For writers, this will change the packets that can be written without a panic.
Source§fn set_compression_threshold(&mut self, threshold: Option<i32>)
fn set_compression_threshold(&mut self, threshold: Option<i32>)
Modifies the compression configuration. If a value of
None is provided, then compression is
disabled. If a value of Some is provided, then the threshold is set to that value. Read moreSource§fn enable_encryption(
&mut self,
key: &[u8],
iv: &[u8],
) -> Result<(), CipherError>
fn enable_encryption( &mut self, key: &[u8], iv: &[u8], ) -> Result<(), CipherError>
Modifies the encryption configuration. This function should only be called once, and can only
be used to enable encryption. Read more
Source§fn set_max_packet_size(&mut self, max_size: usize)
fn set_max_packet_size(&mut self, max_size: usize)
Sets the max packet size which this I/O wrapper will decode or transmit. Read more
fn ensure_buf_capacity(&mut self, capacity: usize)
fn ensure_compression_buf_capacity(&mut self, capacity: usize)
Source§impl<R, W> CraftSyncReader for CraftConnection<R, W>
impl<R, W> CraftSyncReader for CraftConnection<R, W>
fn read_packet<'a, P>(&'a mut self) -> ReadResult<<P as RawPacket<'a>>::Packet>where
P: RawPacket<'a>,
fn read_raw_packet<'a, P>(&'a mut self) -> ReadResult<P>where
P: RawPacket<'a>,
fn read_raw_untyped_packet(&mut self) -> ReadResult<(Id, &[u8])>
Source§impl<R, W> CraftSyncWriter for CraftConnection<R, W>
impl<R, W> CraftSyncWriter for CraftConnection<R, W>
Source§fn write_packet<P>(&mut self, packet: P) -> WriteResult<()>where
P: Packet,
fn write_packet<P>(&mut self, packet: P) -> WriteResult<()>where
P: Packet,
Attempts to serialize, and then write a packet struct to the wrapped stream.
Source§fn write_raw_packet<'a, P>(&mut self, packet: P) -> WriteResult<()>where
P: RawPacket<'a>,
fn write_raw_packet<'a, P>(&mut self, packet: P) -> WriteResult<()>where
P: RawPacket<'a>,
Attempts to write a serialized packet to the wrapped stream Read more
Source§impl<R, W> CraftWrapper<(R, W)> for CraftConnection<R, W>
impl<R, W> CraftWrapper<(R, W)> for CraftConnection<R, W>
Source§fn into_inner(self) -> (R, W)
fn into_inner(self) -> (R, W)
Unwraps the wrapped value of type
I, and drops the wrapper typeAuto Trait Implementations§
impl<R, W> Freeze for CraftConnection<R, W>
impl<R, W> RefUnwindSafe for CraftConnection<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for CraftConnection<R, W>
impl<R, W> Sync for CraftConnection<R, W>
impl<R, W> Unpin for CraftConnection<R, W>
impl<R, W> UnwindSafe for CraftConnection<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