Ethernet2Frame

Struct Ethernet2Frame 

Source
pub struct Ethernet2Frame<'a> {
    pub header: Ethernet2Header,
    pub payload: &'a [u8],
}

Fields§

§header: Ethernet2Header§payload: &'a [u8]

Implementations§

Source§

impl Ethernet2Frame<'_>

Source

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.

Source

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
  • Some If the buffer was long enough.
  • None If the buffer was too short.
Source

pub fn to_bytes(self, buf: &mut [u8]) -> Option<()>

Conveniece method, which calls scroll internally.

This method can only fail if the provided data was too short.

§Returns
  • Some If the buffer was long enough.
  • None If the buffer was too short.

Trait Implementations§

Source§

impl MeasureWith<()> for Ethernet2Frame<'_>

Source§

fn measure_with(&self, _ctx: &()) -> usize

How large is Self, given the ctx?
Source§

impl<'a> TryFromCtx<'a> for Ethernet2Frame<'a>

Source§

type Error = Error

Source§

fn try_from_ctx(from: &'a [u8], _ctx: ()) -> Result<(Self, usize), Self::Error>

Source§

impl TryIntoCtx for Ethernet2Frame<'_>

Source§

type Error = Error

Source§

fn try_into_ctx(self, buf: &mut [u8], _ctx: ()) -> Result<usize, Self::Error>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.