CraftConnection

Struct CraftConnection 

Source
pub struct CraftConnection<R, W> { /* private fields */ }

Implementations§

Source§

impl<R, W> CraftConnection<R, W>

Source

pub fn into_split(self) -> (CraftReader<R>, CraftWriter<W>)

Source

pub fn split(&mut self) -> (&mut CraftReader<R>, &mut CraftWriter<W>)

Source§

impl CraftConnection<BufReader<TcpStream>, TcpStream>

Source

pub fn connect_server_std<A>(to: A) -> Result<Self, Error>
where A: ToSocketAddrs,

Source

pub fn wrap_client_stream_std(stream: TcpStream) -> Result<Self, Error>

Source

pub fn from_std( s1: TcpStream, read_direction: PacketDirection, ) -> Result<Self, Error>

Source

pub fn from_std_with_state( s1: TcpStream, read_direction: PacketDirection, state: State, ) -> Result<Self, Error>

Source§

impl CraftConnection<BufReader<OwnedReadHalf>, OwnedWriteHalf>

Source

pub async fn connect_server_tokio<A>(to: A) -> Result<Self, TokioIoError>

Source§

impl CraftConnection<OwnedReadHalf, OwnedWriteHalf>

Source§

impl<R, W> CraftConnection<R, W>

Source

pub fn from_async(tuple: (R, W), read_direction: PacketDirection) -> Self

Source

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>

Source§

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,

Source§

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,

Source§

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>

Source§

fn write_packet_async<'life0, 'async_trait, P>( &'life0 mut self, packet: P, ) -> Pin<Box<dyn Future<Output = WriteResult<()>> + Send + 'async_trait>>
where P: Packet + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: '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>>
where P: RawPacket<'a> + Send + Sync + 'async_trait, Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Attempts to write a serialized packet to the wrapped stream. Read more
Source§

impl<R, W> CraftIo for CraftConnection<R, W>

Source§

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>)

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 more
Source§

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)

Sets the max packet size which this I/O wrapper will decode or transmit. Read more
Source§

fn ensure_buf_capacity(&mut self, capacity: usize)

Source§

fn ensure_compression_buf_capacity(&mut self, capacity: usize)

Source§

impl<R, W> CraftSyncReader for CraftConnection<R, W>

Source§

fn read_packet<'a, P>(&'a mut self) -> ReadResult<<P as RawPacket<'a>>::Packet>
where P: RawPacket<'a>,

Source§

fn read_raw_packet<'a, P>(&'a mut self) -> ReadResult<P>
where P: RawPacket<'a>,

Source§

fn read_raw_untyped_packet(&mut self) -> ReadResult<(Id, &[u8])>

Source§

impl<R, W> CraftSyncWriter for CraftConnection<R, W>

Source§

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>,

Attempts to write a serialized packet to the wrapped stream Read more
Source§

impl<R, W> CraftWrapper<(R, W)> for CraftConnection<R, W>

Source§

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

Unwraps the wrapped value of type I, and drops the wrapper type

Auto Trait Implementations§

§

impl<R, W> Freeze for CraftConnection<R, W>
where R: Freeze, W: Freeze,

§

impl<R, W> RefUnwindSafe for CraftConnection<R, W>

§

impl<R, W> Send for CraftConnection<R, W>
where R: Send, W: Send,

§

impl<R, W> Sync for CraftConnection<R, W>
where R: Sync, W: Sync,

§

impl<R, W> Unpin for CraftConnection<R, W>
where R: Unpin, W: Unpin,

§

impl<R, W> UnwindSafe for CraftConnection<R, W>
where R: UnwindSafe, W: UnwindSafe,

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