Struct smoltcp::wire::EthernetFrame[][src]

pub struct EthernetFrame<T: AsRef<[u8]>> { /* fields omitted */ }

A read/write wrapper around an Ethernet II frame buffer.

Implementations

impl<T: AsRef<[u8]>> Frame<T>[src]

pub fn new_unchecked(buffer: T) -> Frame<T>[src]

Imbue a raw octet buffer with Ethernet frame structure.

pub fn new_checked(buffer: T) -> Result<Frame<T>>[src]

Shorthand for a combination of new_unchecked and check_len.

pub fn check_len(&self) -> Result<()>[src]

Ensure that no accessor method will panic if called. Returns Err(Error::Truncated) if the buffer is too short.

pub fn into_inner(self) -> T[src]

Consumes the frame, returning the underlying buffer.

pub fn header_len() -> usize[src]

Return the length of a frame header.

pub fn buffer_len(payload_len: usize) -> usize[src]

Return the length of a buffer required to hold a packet with the payload of a given length.

pub fn dst_addr(&self) -> Address[src]

Return the destination address field.

pub fn src_addr(&self) -> Address[src]

Return the source address field.

pub fn ethertype(&self) -> EtherType[src]

Return the EtherType field, without checking for 802.1Q.

impl<'a, T: AsRef<[u8]> + ?Sized> Frame<&'a T>[src]

pub fn payload(&self) -> &'a [u8][src]

Return a pointer to the payload, without checking for 802.1Q.

impl<T: AsRef<[u8]> + AsMut<[u8]>> Frame<T>[src]

pub fn set_dst_addr(&mut self, value: Address)[src]

Set the destination address field.

pub fn set_src_addr(&mut self, value: Address)[src]

Set the source address field.

pub fn set_ethertype(&mut self, value: EtherType)[src]

Set the EtherType field.

pub fn payload_mut(&mut self) -> &mut [u8][src]

Return a mutable pointer to the payload.

Trait Implementations

impl<T: AsRef<[u8]>> AsRef<[u8]> for Frame<T>[src]

impl<T: Clone + AsRef<[u8]>> Clone for Frame<T>[src]

impl<T: Debug + AsRef<[u8]>> Debug for Frame<T>[src]

impl<T: AsRef<[u8]>> Display for Frame<T>[src]

impl<T: AsRef<[u8]>> PrettyPrint for Frame<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Frame<T> where
    T: RefUnwindSafe

impl<T> Send for Frame<T> where
    T: Send

impl<T> Sync for Frame<T> where
    T: Sync

impl<T> Unpin for Frame<T> where
    T: Unpin

impl<T> UnwindSafe for Frame<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.