Struct etherparse::Ethernet2Header
source · Expand description
Ethernet II header.
Fields§
§source: [u8; 6]§destination: [u8; 6]§ether_type: u16Implementations§
source§impl Ethernet2Header
impl Ethernet2Header
sourcepub fn read_from_slice(
slice: &[u8]
) -> Result<(Ethernet2Header, &[u8]), ReadError>
👎Deprecated since 0.10.1: Use Ethernet2Header::from_slice instead.
pub fn read_from_slice(
slice: &[u8]
) -> Result<(Ethernet2Header, &[u8]), ReadError>
Creates a ethernet slice from an other slice.
sourcepub fn from_slice(slice: &[u8]) -> Result<(Ethernet2Header, &[u8]), ReadError>
pub fn 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 from_bytes(bytes: [u8; 14]) -> Ethernet2Header
pub fn from_bytes(bytes: [u8; 14]) -> Ethernet2Header
Read an Ethernet2Header from a static sized byte array.
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.
sourcepub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), Error>
pub fn write<T: Write + Sized>(&self, writer: &mut T) -> Result<(), Error>
Writes a given Ethernet-II header to the current position of the write argument.
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Length of the serialized header in bytes.
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.