Struct blaze_pk::OpaquePacket
source · pub struct OpaquePacket(pub PacketHeader, pub Vec<u8>);
Expand description
Structure for packets that have been read where the contents are not know and are encoded as a vector of bytes.
Tuple Fields
0: PacketHeader
1: Vec<u8>
Implementations
sourceimpl OpaquePacket
impl OpaquePacket
sourcepub fn contents<R: Codec>(&self) -> CodecResult<R>
pub fn contents<R: Codec>(&self) -> CodecResult<R>
Reads the contents of this encoded packet and tries to decode
the R
from it.
sourcepub fn debug_decode(&self) -> CodecResult<String>
pub fn debug_decode(&self) -> CodecResult<String>
Debug decoding decodes self printing all the hit nodes
sourcepub fn read<R: Read>(input: &mut R) -> PacketResult<Self>where
Self: Sized,
pub fn read<R: Read>(input: &mut R) -> PacketResult<Self>where
Self: Sized,
Reads a packet from the provided input without parsing the contents of the packet
pub fn read_typed<R: Read, T: PacketComponents>(
input: &mut R
) -> PacketResult<(T, Self)>where
Self: Sized,
sourcepub async fn read_async<R: AsyncRead + Unpin>(
input: &mut R
) -> PacketResult<Self>where
Self: Sized,
pub async fn read_async<R: AsyncRead + Unpin>(
input: &mut R
) -> PacketResult<Self>where
Self: Sized,
Reads a packet from the provided input without parsing the contents of the packet
sourcepub async fn read_async_typed<T: PacketComponents, R: AsyncRead + Unpin>(
input: &mut R
) -> PacketResult<(T, Self)>where
Self: Sized,
pub async fn read_async_typed<T: PacketComponents, R: AsyncRead + Unpin>(
input: &mut R
) -> PacketResult<(T, Self)>where
Self: Sized,
Reads a packet from the provided input without parsing the contents of the packet
sourcepub async fn read_async_blaze<R: AsyncRead + AsyncWrite + Unpin>(
input: &mut BlazeStream<R>
) -> PacketResult<Self>where
Self: Sized,
pub async fn read_async_blaze<R: AsyncRead + AsyncWrite + Unpin>(
input: &mut BlazeStream<R>
) -> PacketResult<Self>where
Self: Sized,
Reads a packet from the provided input without parsing the contents of the packet
sourcepub async fn read_async_typed_blaze<T: PacketComponents, R: AsyncRead + AsyncWrite + Unpin>(
input: &mut BlazeStream<R>
) -> PacketResult<(T, Self)>where
Self: Sized,
pub async fn read_async_typed_blaze<T: PacketComponents, R: AsyncRead + AsyncWrite + Unpin>(
input: &mut BlazeStream<R>
) -> PacketResult<(T, Self)>where
Self: Sized,
Reads a packet from the provided input without parsing the contents of the packet
sourcepub fn write<W: Write>(&self, output: &mut W) -> Result<()>where
Self: Sized,
pub fn write<W: Write>(&self, output: &mut W) -> Result<()>where
Self: Sized,
Handles writing the header and contents of this packet to the Writable object
sourcepub async fn write_async<W: AsyncWrite + Unpin>(
&self,
output: &mut W
) -> Result<()>where
Self: Sized,
pub async fn write_async<W: AsyncWrite + Unpin>(
&self,
output: &mut W
) -> Result<()>where
Self: Sized,
Handles writing the header and contents of this packet to the Writable object
sourcepub fn write_blaze<W: AsyncRead + AsyncWrite + Unpin>(
&self,
output: &mut BlazeStream<W>
) -> Result<()>where
Self: Sized,
pub fn write_blaze<W: AsyncRead + AsyncWrite + Unpin>(
&self,
output: &mut BlazeStream<W>
) -> Result<()>where
Self: Sized,
Handles writing the header and contents of this packet to the Writable object
sourcepub fn write_bytes(&self, output: &mut Vec<u8>)
pub fn write_bytes(&self, output: &mut Vec<u8>)
Appends the header and contents of this packet to the provided output Vec of bytes.
sourcepub fn encode_bytes(&self) -> Vec<u8>
pub fn encode_bytes(&self) -> Vec<u8>
Encodes this packet header and contents into a Vec. Vec may be over allocated by 2 bytes to prevent reallocation for longer packets.