Struct etherparse::Ethernet2HeaderSlice
source · pub struct Ethernet2HeaderSlice<'a> { /* private fields */ }
Expand description
A slice containing an ethernet 2 header of a network package.
Implementations§
source§impl<'a> Ethernet2HeaderSlice<'a>
impl<'a> Ethernet2HeaderSlice<'a>
sourcepub fn from_slice(
slice: &'a [u8]
) -> Result<Ethernet2HeaderSlice<'a>, ReadError>
pub fn from_slice(
slice: &'a [u8]
) -> Result<Ethernet2HeaderSlice<'a>, ReadError>
Creates a ethernet slice from an other slice.
sourcepub fn destination(&self) -> [u8; 6]
pub fn destination(&self) -> [u8; 6]
Read the destination mac address
sourcepub fn ether_type(&self) -> u16
pub fn ether_type(&self) -> u16
Read the ether_type field of the header (in system native byte order).
sourcepub fn to_header(&self) -> Ethernet2Header
pub fn to_header(&self) -> Ethernet2Header
Decode all the fields and copy the results to a Ipv4Header struct
Trait Implementations§
source§impl<'a> Clone for Ethernet2HeaderSlice<'a>
impl<'a> Clone for Ethernet2HeaderSlice<'a>
source§fn clone(&self) -> Ethernet2HeaderSlice<'a>
fn clone(&self) -> Ethernet2HeaderSlice<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more