pub struct EthernetFrame<'a> { /* private fields */ }Expand description
A read/write wrapper around an Ethernet II frame buffer.
Implementations§
Source§impl<'a> Frame<'a>
impl<'a> Frame<'a>
Sourcepub 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.
Sourcepub fn new_checked(buffer: &'a mut [u8]) -> Result<Frame<'a>>
pub fn new_checked(buffer: &'a mut [u8]) -> Result<Frame<'a>>
Shorthand for a combination of new_unchecked and check_len.
Sourcepub fn check_len(&self) -> Result<()>
pub fn check_len(&self) -> Result<()>
Ensure that no accessor method will panic if called.
Returns Err(Error) if the buffer is too short.
Sourcepub const fn header_len() -> usize
pub const fn header_len() -> usize
Return the length of a frame header.
Sourcepub 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.
Sourcepub fn set_dst_addr(&mut self, value: Address)
pub fn set_dst_addr(&mut self, value: Address)
Set the destination address field.
Sourcepub fn set_src_addr(&mut self, value: Address)
pub fn set_src_addr(&mut self, value: Address)
Set the source address field.
Sourcepub fn set_ethertype(&mut self, value: EtherType)
pub fn set_ethertype(&mut self, value: EtherType)
Set the EtherType field.
Sourcepub 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