Struct EthernetFrame
pub struct EthernetFrame<'a> { /* private fields */ }Expand description
A read/write wrapper around an Ethernet II frame buffer.
Implementations§
§impl<'a> Frame<'a>
impl<'a> Frame<'a>
pub const fn new_unchecked(buffer: &'a mut [u8]) -> Frame<'a>
pub const fn new_unchecked(buffer: &'a mut [u8]) -> Frame<'a>
Imbue a raw octet buffer with Ethernet frame structure.
pub fn new_checked(buffer: &'a mut [u8]) -> Result<Frame<'a>, Error>
pub fn new_checked(buffer: &'a mut [u8]) -> Result<Frame<'a>, Error>
Shorthand for a combination of new_unchecked and check_len.
pub fn check_len(&self) -> Result<(), Error>
pub fn check_len(&self) -> Result<(), Error>
Ensure that no accessor method will panic if called.
Returns Err(Error) if the buffer is too short.
pub const fn header_len() -> usize
pub const fn header_len() -> usize
Return the length of a frame header.
pub const fn buffer_len(payload_len: usize) -> usize
pub const fn buffer_len(payload_len: usize) -> usize
Return the length of a buffer required to hold a packet with the payload of a given length.
pub fn set_dst_addr(&mut self, value: Address)
pub fn set_dst_addr(&mut self, value: Address)
Set the destination address field.
pub fn set_src_addr(&mut self, value: Address)
pub fn set_src_addr(&mut self, value: Address)
Set the source address field.
pub fn set_ethertype(&mut self, value: EtherType)
pub fn set_ethertype(&mut self, value: EtherType)
Set the EtherType field.
pub fn payload_mut(&mut self) -> &mut [u8] ⓘ
pub fn payload_mut(&mut self) -> &mut [u8] ⓘ
Return a mutable pointer to the payload.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for Frame<'a>
impl<'a> Freeze for Frame<'a>
impl<'a> RefUnwindSafe for Frame<'a>
impl<'a> Send for Frame<'a>
impl<'a> Sync for Frame<'a>
impl<'a> Unpin for Frame<'a>
impl<'a> UnsafeUnpin for Frame<'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