Struct etherparse::Ethernet2Header
source · Expand description
Ethernet II header.
Fields§
§source: [u8; 6]
§destination: [u8; 6]
§ether_type: u16
Implementations§
source§impl Ethernet2Header
impl Ethernet2Header
sourcepub fn read_from_slice(
slice: &[u8]
) -> Result<(Ethernet2Header, &[u8]), ReadError>
pub fn read_from_slice(
slice: &[u8]
) -> Result<(Ethernet2Header, &[u8]), ReadError>
Read an Ethernet2Header from a slice and return the header & unused parts of the slice.
sourcepub fn read<T: Read + Seek + Sized>(
reader: &mut T
) -> Result<Ethernet2Header, Error>
pub fn read<T: Read + Seek + Sized>(
reader: &mut T
) -> Result<Ethernet2Header, Error>
Reads an Ethernet-II header from the current position of the read argument.
sourcepub fn write_to_slice<'a>(
&self,
slice: &'a mut [u8]
) -> Result<&'a mut [u8], WriteError>
pub fn write_to_slice<'a>(
&self,
slice: &'a mut [u8]
) -> Result<&'a mut [u8], WriteError>
Serialize the header to a given slice. Returns the unused part of the slice.
Trait Implementations§
source§impl Clone for Ethernet2Header
impl Clone for Ethernet2Header
source§fn clone(&self) -> Ethernet2Header
fn clone(&self) -> Ethernet2Header
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 moresource§impl Debug for Ethernet2Header
impl Debug for Ethernet2Header
source§impl Default for Ethernet2Header
impl Default for Ethernet2Header
source§fn default() -> Ethernet2Header
fn default() -> Ethernet2Header
Returns the “default value” for a type. Read more
source§impl PartialEq<Ethernet2Header> for Ethernet2Header
impl PartialEq<Ethernet2Header> for Ethernet2Header
source§fn eq(&self, other: &Ethernet2Header) -> bool
fn eq(&self, other: &Ethernet2Header) -> bool
source§impl SerializedSize for Ethernet2Header
impl SerializedSize for Ethernet2Header
source§const SERIALIZED_SIZE: usize = 14usize
const SERIALIZED_SIZE: usize = 14usize
Serialized size of the header in bytes.