pub struct FrameHeader {
pub version: u8,
pub reserved: u8,
pub msg_type: MsgType,
pub sequence: u32,
pub payload_len: u32,
}Expand description
Parsed representation of the 11-byte frame header.
Fields§
§version: u8Protocol version (always PROTOCOL_VERSION).
reserved: u8Transport identifier: 0=protocol (reserved for future use).
msg_type: MsgTypeMessage type tag.
sequence: u32Monotonically increasing sequence number (LE).
payload_len: u32Length of the payload that follows this header (LE).
Implementations§
Source§impl FrameHeader
impl FrameHeader
Sourcepub fn write_to(&self, buf: &mut Vec<u8>)
pub fn write_to(&self, buf: &mut Vec<u8>)
Serialise the header into buf (appends exactly FRAME_HEADER_SIZE bytes).
Sourcepub fn read_from(data: &[u8]) -> Option<Self>
pub fn read_from(data: &[u8]) -> Option<Self>
Attempt to parse a header from the first 11 bytes of data.
Returns None if data is shorter than FRAME_HEADER_SIZE.
Trait Implementations§
Source§impl Clone for FrameHeader
impl Clone for FrameHeader
Source§fn clone(&self) -> FrameHeader
fn clone(&self) -> FrameHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FrameHeader
impl Debug for FrameHeader
Source§impl PartialEq for FrameHeader
impl PartialEq for FrameHeader
impl Copy for FrameHeader
impl Eq for FrameHeader
impl StructuralPartialEq for FrameHeader
Auto Trait Implementations§
impl Freeze for FrameHeader
impl RefUnwindSafe for FrameHeader
impl Send for FrameHeader
impl Sync for FrameHeader
impl Unpin for FrameHeader
impl UnsafeUnpin for FrameHeader
impl UnwindSafe for FrameHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more