pub struct Packet { /* private fields */ }Implementations§
Source§impl Packet
impl Packet
pub fn new(headroom: usize, capacity: usize) -> Self
pub fn with_headroom(headroom: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn headroom(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn push<T: AsBytes>(&self, item: T) -> Hdr<T>
pub fn push<T: AsBytes>(&self, item: T) -> Hdr<T>
Append a new header to the packet and initialize it
Sourcepub fn push_bytes<T: AsRef<[u8]>>(&self, bytes: T) -> PktSlice
pub fn push_bytes<T: AsRef<[u8]>>(&self, bytes: T) -> PktSlice
Append a bunch of bytes and return their offset
Sourcepub fn push_slice(&self, len: usize) -> PktSlice
pub fn push_slice(&self, len: usize) -> PktSlice
Expand the packet by len bytes and return a handle to the bytes
Sourcepub fn lower_headroom<T: AsBytes>(&mut self) -> Hdr<T>
pub fn lower_headroom<T: AsBytes>(&mut self) -> Hdr<T>
Prepend a new header into the packet headroom
Sourcepub fn lower_headroom_for<T: AsBytes>(&mut self, item: T) -> Hdr<T>
pub fn lower_headroom_for<T: AsBytes>(&mut self, item: T) -> Hdr<T>
Prepend a new header into the packet headroom
Sourcepub fn return_headroom<T: AsBytes>(&mut self, hdr: Hdr<T>)
pub fn return_headroom<T: AsBytes>(&mut self, hdr: Hdr<T>)
Return headroom to the packet. Header must start at the first byte of packet buffer
pub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn to_vec_from(&self, ps: PktSlice) -> Vec<u8> ⓘ
pub fn into_vec_from(self, ps: PktSlice) -> Vec<u8> ⓘ
Trait Implementations§
impl Eq for Packet
impl StructuralPartialEq for Packet
Auto Trait Implementations§
impl !Freeze for Packet
impl !RefUnwindSafe for Packet
impl Send for Packet
impl !Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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