pub struct Ethernet2Frame<'a> {
pub header: Ethernet2Header,
pub payload: &'a [u8],
}Fields§
§header: Ethernet2Header§payload: &'a [u8]Implementations§
Source§impl Ethernet2Frame<'_>
impl Ethernet2Frame<'_>
Sourcepub const fn length_in_bytes(&self) -> usize
pub const fn length_in_bytes(&self) -> usize
Total length in bytes.
This being an associated item, allows us to make it constant. This enables the compiler to perform more inlining.
Sourcepub fn from_bytes<'a>(bytes: &'a [u8]) -> Option<Ethernet2Frame<'a>>
pub fn from_bytes<'a>(bytes: &'a [u8]) -> Option<Ethernet2Frame<'a>>
Conveniece method, which calls scroll internally.
This method can only fail if the provided data was too short.
§Returns
SomeIf the buffer was long enough.NoneIf the buffer was too short.
Trait Implementations§
Source§impl MeasureWith<()> for Ethernet2Frame<'_>
impl MeasureWith<()> for Ethernet2Frame<'_>
Source§fn measure_with(&self, _ctx: &()) -> usize
fn measure_with(&self, _ctx: &()) -> usize
How large is
Self, given the ctx?Source§impl<'a> TryFromCtx<'a> for Ethernet2Frame<'a>
impl<'a> TryFromCtx<'a> for Ethernet2Frame<'a>
Auto Trait Implementations§
impl<'a> Freeze for Ethernet2Frame<'a>
impl<'a> RefUnwindSafe for Ethernet2Frame<'a>
impl<'a> Send for Ethernet2Frame<'a>
impl<'a> Sync for Ethernet2Frame<'a>
impl<'a> Unpin for Ethernet2Frame<'a>
impl<'a> UnwindSafe for Ethernet2Frame<'a>
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