pub struct EthernetWriter<'a> {
pub bytes: &'a mut [u8],
/* private fields */
}
Expand description
Writes Ethernet header fields.
Fields§
§bytes: &'a mut [u8]
Implementations§
Source§impl<'a> EthernetWriter<'a>
impl<'a> EthernetWriter<'a>
Sourcepub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>
pub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>
Creates a new EthernetWriter
from the given slice.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&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 field.
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 field.
Sourcepub fn set_ethertype(&mut self, ethertype: u16)
pub fn set_ethertype(&mut self, ethertype: u16)
Sets the EtherType field.
EtherType indicates which protocol is encapsulated in the payload.
Auto Trait Implementations§
impl<'a> Freeze for EthernetWriter<'a>
impl<'a> RefUnwindSafe for EthernetWriter<'a>
impl<'a> Send for EthernetWriter<'a>
impl<'a> Sync for EthernetWriter<'a>
impl<'a> Unpin for EthernetWriter<'a>
impl<'a> !UnwindSafe for EthernetWriter<'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