[][src]Struct etherparse::Ethernet2Header

pub struct Ethernet2Header {
    pub source: [u8; 6],
    pub destination: [u8; 6],
    pub ether_type: u16,
}

Ethernet II header.

Fields

source: [u8; 6]destination: [u8; 6]ether_type: u16

Methods

impl Ethernet2Header[src]

pub fn read_from_slice(
    slice: &[u8]
) -> Result<(Ethernet2Header, &[u8]), ReadError>
[src]

Read an Ethernet2Header from a slice and return the header & unused parts of the slice.

pub fn read<T: Read + Seek + Sized>(
    reader: &mut T
) -> Result<Ethernet2Header, Error>
[src]

Reads an Ethernet-II header from the current position of the read argument.

pub fn write_to_slice<'a>(
    &self,
    slice: &'a mut [u8]
) -> Result<&'a mut [u8], WriteError>
[src]

Serialize the header to a given slice. Returns the unused part of the slice.

pub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), Error>[src]

Writes a given Ethernet-II header to the current position of the write argument.

Trait Implementations

impl SerializedSize for Ethernet2Header[src]

const SERIALIZED_SIZE: usize[src]

Serialized size of the header in bytes.

impl Clone for Ethernet2Header[src]

impl Default for Ethernet2Header[src]

impl Eq for Ethernet2Header[src]

impl PartialEq<Ethernet2Header> for Ethernet2Header[src]

impl Debug for Ethernet2Header[src]

impl StructuralPartialEq for Ethernet2Header[src]

impl StructuralEq for Ethernet2Header[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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