Struct zero_packet::datalink::ethernet::EthernetBuilder
source · pub struct EthernetBuilder<'a> {
pub data: &'a mut [u8],
}
Expand description
Represents an Ethernet frame builder.
Fields§
§data: &'a mut [u8]
Implementations§
source§impl<'a> EthernetBuilder<'a>
impl<'a> EthernetBuilder<'a>
sourcepub fn new(data: &'a mut [u8]) -> Result<Self, &'static str>
pub fn new(data: &'a mut [u8]) -> Result<Self, &'static str>
Creates a new EthernetFrame
from the given slice.
Returns an error if the smallest possible Ethernet header does not fit in the slice.
sourcepub fn header_length(&self) -> usize
pub fn header_length(&self) -> usize
Returns the header length in bytes.
sourcepub fn set_dest_mac(&mut self, dest: &[u8; 6])
pub fn set_dest_mac(&mut self, dest: &[u8; 6])
Sets the destination MAC address.
sourcepub fn set_src_mac(&mut self, src: &[u8; 6])
pub fn set_src_mac(&mut self, src: &[u8; 6])
Sets the source MAC address.
sourcepub fn set_ethertype(&mut self, ethertype: u16)
pub fn set_ethertype(&mut self, ethertype: u16)
Sets the EtherType field.
EtherType indicates which protcol is encapsulated in the payload.
Auto Trait Implementations§
impl<'a> Freeze for EthernetBuilder<'a>
impl<'a> RefUnwindSafe for EthernetBuilder<'a>
impl<'a> Send for EthernetBuilder<'a>
impl<'a> Sync for EthernetBuilder<'a>
impl<'a> Unpin for EthernetBuilder<'a>
impl<'a> !UnwindSafe for EthernetBuilder<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more