pub struct IcmpMessageBuffer { /* private fields */ }
Expand description
A helper for constructing ICMP packets.
Implementations§
Source§impl IcmpMessageBuffer
impl IcmpMessageBuffer
Sourcepub fn new(typ: u8, code: u8, body: &[u8]) -> Self
pub fn new(typ: u8, code: u8, body: &[u8]) -> Self
Create a new buffer with the provided ICMP type typ
, code
, and body
.
Sourcepub fn set_body(&mut self, body: impl IntoIterator<Item = u8>)
pub fn set_body(&mut self, body: impl IntoIterator<Item = u8>)
Set the type-specific ICMP message body
Sourcepub fn extend_body(&mut self, body_suffix: impl IntoIterator<Item = u8>)
pub fn extend_body(&mut self, body_suffix: impl IntoIterator<Item = u8>)
Append body_suffix
to the buffer, leaving the existing body in place
Sourcepub fn truncate_body(&mut self, body_len: usize)
pub fn truncate_body(&mut self, body_len: usize)
Truncate the message body at body_len
bytes
Trait Implementations§
Source§impl Clone for IcmpMessageBuffer
impl Clone for IcmpMessageBuffer
Source§fn clone(&self) -> IcmpMessageBuffer
fn clone(&self) -> IcmpMessageBuffer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for IcmpMessageBuffer
impl RefUnwindSafe for IcmpMessageBuffer
impl Send for IcmpMessageBuffer
impl Sync for IcmpMessageBuffer
impl Unpin for IcmpMessageBuffer
impl UnwindSafe for IcmpMessageBuffer
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