pub struct MutIpv4Packet<'a>(/* private fields */);Implementations§
Source§impl<'a> MutIpv4Packet<'a>
impl<'a> MutIpv4Packet<'a>
Sourcepub const MIN_LEN: usize = 20usize
pub const MIN_LEN: usize = 20usize
The minimum number of bytes in this type of packet. Usually equal to the header size of the protocol.
Sourcepub fn new(data: &'a mut [u8]) -> Option<MutIpv4Packet<'a>>
pub fn new(data: &'a mut [u8]) -> Option<MutIpv4Packet<'a>>
Creates a new mutable packet based on the given backing slice. Returns None if
the buffer is shorter than the minimal length of this packet.
Sourcepub unsafe fn new_unchecked(data: &'a mut [u8]) -> MutIpv4Packet<'a>
pub unsafe fn new_unchecked(data: &'a mut [u8]) -> MutIpv4Packet<'a>
Creates a new mutable packet based on the given backing slice without checking its length first. If the slice is too short, a subsequent read from a field might result in invalid memory access.
Sourcepub fn as_immutable(&'a self) -> Ipv4Packet<'a>
pub fn as_immutable(&'a self) -> Ipv4Packet<'a>
Returns an immutable version of the same packet and backed by the same byte slice. Used to access the getters.
Sourcepub fn data(&mut self) -> &mut [u8] ⓘ
pub fn data(&mut self) -> &mut [u8] ⓘ
Returns a mutable reference to the slice backing this packet.
Source§impl<'a> MutIpv4Packet<'a>
impl<'a> MutIpv4Packet<'a>
pub fn set_version(&mut self, version: u4)
pub fn set_header_length(&mut self, header_length: u4)
pub fn set_dscp(&mut self, dscp: u6)
pub fn set_ecn(&mut self, ecn: u2)
pub fn set_total_length(&mut self, total_length: u16)
pub fn set_identification(&mut self, identification: u16)
pub fn set_flags(&mut self, flags: Flags)
pub fn set_fragment_offset(&mut self, fragment_offset: u13)
pub fn set_ttl(&mut self, ttl: u8)
pub fn set_protocol(&mut self, protocol: Protocol)
pub fn set_header_checksum(&mut self, checksum: u16)
pub fn set_source(&mut self, source: Ipv4Addr)
pub fn set_destination(&mut self, destination: Ipv4Addr)
Auto Trait Implementations§
impl<'a> Freeze for MutIpv4Packet<'a>
impl<'a> RefUnwindSafe for MutIpv4Packet<'a>
impl<'a> Send for MutIpv4Packet<'a>
impl<'a> Sync for MutIpv4Packet<'a>
impl<'a> Unpin for MutIpv4Packet<'a>
impl<'a> !UnwindSafe for MutIpv4Packet<'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