[−][src]Struct craftio_rs::CraftReader
Wraps some stream of type R
, and implements either CraftSyncReader
or CraftAsyncReader
(or both)
based on what types R
implements.
You can construct this type calling the function wrap_with_state
, which requires you to specify
a packet direction (are written packets server-bound or client-bound?) and a state
(handshaking
? login
? status
? play
?).
This type holds some internal buffers but only allocates them when they are required.
Implementations
impl<R> CraftReader<R>
[src]
pub fn wrap(inner: R, direction: PacketDirection) -> Self
[src]
pub fn wrap_with_state(
inner: R,
direction: PacketDirection,
state: State
) -> Self
[src]
inner: R,
direction: PacketDirection,
state: State
) -> Self
Trait Implementations
impl<R> CraftAsyncReader for CraftReader<R> where
R: AsyncReadExact,
[src]
R: AsyncReadExact,
pub 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>,
'a: 'async_trait,
P: 'async_trait,
Self: 'async_trait,
[src]
&'a mut self
) -> Pin<Box<dyn Future<Output = ReadResult<P>> + Send + 'async_trait>> where
P: RawPacket<'a>,
'a: 'async_trait,
P: 'async_trait,
Self: 'async_trait,
pub fn read_raw_untyped_packet_async<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = ReadResult<(Id, &[u8])>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = ReadResult<(Id, &[u8])>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
#[must_use]pub 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>,
'a: 'async_trait,
P: 'async_trait,
Self: Send + 'async_trait,
[src]
&'a mut self
) -> Pin<Box<dyn Future<Output = ReadResult<<P as RawPacket<'a>>::Packet>> + Send + 'async_trait>> where
P: RawPacket<'a>,
'a: 'async_trait,
P: 'async_trait,
Self: Send + 'async_trait,
impl<R> CraftIo for CraftReader<R>
[src]
pub fn set_state(&mut self, next: State)
[src]
pub fn set_compression_threshold(&mut self, threshold: Option<i32>)
[src]
pub fn enable_encryption(
&mut self,
key: &[u8],
iv: &[u8]
) -> Result<(), CipherError>
[src]
&mut self,
key: &[u8],
iv: &[u8]
) -> Result<(), CipherError>
pub fn set_max_packet_size(&mut self, max_size: usize)
[src]
pub fn ensure_buf_capacity(&mut self, capacity: usize)
[src]
pub fn ensure_compression_buf_capacity(&mut self, capacity: usize)
[src]
impl<R> CraftSyncReader for CraftReader<R> where
R: Read,
[src]
R: Read,
pub fn read_raw_packet<'a, P>(&'a mut self) -> ReadResult<P> where
P: RawPacket<'a>,
[src]
P: RawPacket<'a>,
pub fn read_raw_untyped_packet(&mut self) -> ReadResult<(Id, &[u8])>
[src]
pub fn read_packet<'a, P>(
&'a mut self
) -> ReadResult<<P as RawPacket<'a>>::Packet> where
P: RawPacket<'a>,
[src]
&'a mut self
) -> ReadResult<<P as RawPacket<'a>>::Packet> where
P: RawPacket<'a>,
impl<R> CraftWrapper<R> for CraftReader<R>
[src]
pub fn into_inner(self) -> R
[src]
Auto Trait Implementations
impl<R> RefUnwindSafe for CraftReader<R> where
R: RefUnwindSafe,
[src]
R: RefUnwindSafe,
impl<R> Send for CraftReader<R> where
R: Send,
[src]
R: Send,
impl<R> Sync for CraftReader<R> where
R: Sync,
[src]
R: Sync,
impl<R> Unpin for CraftReader<R> where
R: Unpin,
[src]
R: Unpin,
impl<R> UnwindSafe for CraftReader<R> where
R: UnwindSafe,
[src]
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,