pub struct Packet<C: Codec>(pub PacketHeader, pub C);
Expand description
Structure for a packet created by ourselves where the data contents are already known and not encoded
Tuple Fields
0: PacketHeader
1: C
Implementations
sourceimpl<C: Codec> Packet<C>
impl<C: Codec> Packet<C>
sourcepub fn opaque(self) -> OpaquePacket
pub fn opaque(self) -> OpaquePacket
Converts this packet into an opaque packet
sourcepub fn read<R: Read>(input: &mut R) -> PacketResult<Packet<C>>where
Self: Sized,
pub fn read<R: Read>(input: &mut R) -> PacketResult<Packet<C>>where
Self: Sized,
Reads a packet from the provided input and parses the contents
sourcepub fn read_typed<T: PacketComponents, R: Read>(
input: &mut R
) -> PacketResult<(T, C)>where
Self: Sized,
pub fn read_typed<T: PacketComponents, R: Read>(
input: &mut R
) -> PacketResult<(T, C)>where
Self: Sized,
Reads a packet from the provided input and parses the contents
Trait Implementations
Auto Trait Implementations
impl<C> RefUnwindSafe for Packet<C>where
C: RefUnwindSafe,
impl<C> Send for Packet<C>where
C: Send,
impl<C> Sync for Packet<C>where
C: Sync,
impl<C> Unpin for Packet<C>where
C: Unpin,
impl<C> UnwindSafe for Packet<C>where
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more