pub struct MutableEthernetPacket<'a> { /* private fields */ }Expand description
Represents a mutable Ethernet packet.
Implementations§
Source§impl<'a> MutableEthernetPacket<'a>
impl<'a> MutableEthernetPacket<'a>
Sourcepub fn new_unchecked(buffer: &'a mut [u8]) -> Self
pub fn new_unchecked(buffer: &'a mut [u8]) -> Self
Create a mutable packet without performing size checks.
Sourcepub fn get_destination(&self) -> MacAddr
pub fn get_destination(&self) -> MacAddr
Retrieve the destination MAC address.
Sourcepub fn set_destination(&mut self, addr: MacAddr)
pub fn set_destination(&mut self, addr: MacAddr)
Update the destination MAC address.
Sourcepub fn get_source(&self) -> MacAddr
pub fn get_source(&self) -> MacAddr
Retrieve the source MAC address.
Sourcepub fn set_source(&mut self, addr: MacAddr)
pub fn set_source(&mut self, addr: MacAddr)
Update the source MAC address.
Sourcepub fn get_ethertype(&self) -> EtherType
pub fn get_ethertype(&self) -> EtherType
Retrieve the EtherType.
Sourcepub fn set_ethertype(&mut self, ty: EtherType)
pub fn set_ethertype(&mut self, ty: EtherType)
Update the EtherType.
Trait Implementations§
Source§impl<'a> MutablePacket<'a> for MutableEthernetPacket<'a>
impl<'a> MutablePacket<'a> for MutableEthernetPacket<'a>
Source§type Packet = EthernetPacket
type Packet = EthernetPacket
The immutable packet type associated with this mutable view.
Source§fn new(buffer: &'a mut [u8]) -> Option<Self>
fn new(buffer: &'a mut [u8]) -> Option<Self>
Construct a mutable packet from the provided buffer.
Source§fn packet_mut(&mut self) -> &mut [u8] ⓘ
fn packet_mut(&mut self) -> &mut [u8] ⓘ
Get a mutable view over the entire packet buffer.
Source§fn header_mut(&mut self) -> &mut [u8] ⓘ
fn header_mut(&mut self) -> &mut [u8] ⓘ
Get a mutable view over the serialized header bytes of the packet.
Source§fn payload_mut(&mut self) -> &mut [u8] ⓘ
fn payload_mut(&mut self) -> &mut [u8] ⓘ
Get a mutable view over the payload bytes of the packet.
Auto Trait Implementations§
impl<'a> Freeze for MutableEthernetPacket<'a>
impl<'a> RefUnwindSafe for MutableEthernetPacket<'a>
impl<'a> Send for MutableEthernetPacket<'a>
impl<'a> Sync for MutableEthernetPacket<'a>
impl<'a> Unpin for MutableEthernetPacket<'a>
impl<'a> !UnwindSafe for MutableEthernetPacket<'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