pub struct FrameHeader {
pub ether_type: u16,
pub kind: u8,
pub version: u8,
pub crc: u32,
}Expand description
Frame header structure (fixed-width, 8 bytes)
Fields§
§ether_type: u16EtherType identifying the protocol
kind: u8Frame kind (see FrameKind enum)
version: u8Protocol version
crc: u32CRC32 checksum of payload
Implementations§
Source§impl FrameHeader
impl FrameHeader
Sourcepub fn new(ether_type: u16, kind: u8, payload: &[u8]) -> Self
pub fn new(ether_type: u16, kind: u8, payload: &[u8]) -> Self
Create a new frame header with computed CRC from pre-encoded payload
Sourcepub fn encode_into(&self, buf: &mut [u8; 8])
pub fn encode_into(&self, buf: &mut [u8; 8])
Encode header directly into a pre-allocated buffer (zero-copy)
OPTIMIZATION: Assigns bytes directly to constant indices instead of calling copy_from_slice.
This eliminates slice bounds checking overhead and enables rustc/LLVM to emit optimal stores.
Trait Implementations§
Source§impl Clone for FrameHeader
impl Clone for FrameHeader
impl Copy 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more