Struct blaze_pk::PacketHeader
source · pub struct PacketHeader {
pub component: u16,
pub command: u16,
pub error: u16,
pub ty: PacketType,
pub id: u16,
}
Expand description
Structure of packet header which comes before the packet content and describes it.
Fields
component: u16
The component of this packet
command: u16
The command of this packet
error: u16
A possible error this packet contains (zero is none)
ty: PacketType
The type of this packet
id: u16
The unique ID of this packet (Notify packets this is just zero)
Implementations
sourceimpl PacketHeader
impl PacketHeader
sourcepub fn path_matches(&self, other: &PacketHeader) -> bool
pub fn path_matches(&self, other: &PacketHeader) -> bool
Checks if the component and command of this packet header matches that of the other packet header
sourcepub fn encode_bytes(&self, length: usize) -> Vec<u8>
pub fn encode_bytes(&self, length: usize) -> Vec<u8>
Encodes a packet header with the provided length value
sourcepub fn read<R: Read>(input: &mut R) -> PacketResult<(PacketHeader, usize)>where
Self: Sized,
pub fn read<R: Read>(input: &mut R) -> PacketResult<(PacketHeader, usize)>where
Self: Sized,
Reads a packet header from the provided input as well as the length of the content
Trait Implementations
sourceimpl Clone for PacketHeader
impl Clone for PacketHeader
sourcefn clone(&self) -> PacketHeader
fn clone(&self) -> PacketHeader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for PacketHeader
impl Debug for PacketHeader
sourceimpl PartialEq<PacketHeader> for PacketHeader
impl PartialEq<PacketHeader> for PacketHeader
sourcefn eq(&self, other: &PacketHeader) -> bool
fn eq(&self, other: &PacketHeader) -> bool
impl Eq for PacketHeader
impl StructuralEq for PacketHeader
impl StructuralPartialEq for PacketHeader
Auto Trait Implementations
impl RefUnwindSafe for PacketHeader
impl Send for PacketHeader
impl Sync for PacketHeader
impl Unpin for PacketHeader
impl UnwindSafe for PacketHeader
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