pub struct RawPacket {
pub frame_number: u64,
pub timestamp_us: i64,
pub captured_length: u32,
pub original_length: u32,
pub link_type: u16,
pub data: Bytes,
}Expand description
Raw packet data from a reader.
Fields§
§frame_number: u64Frame number (1-indexed)
timestamp_us: i64Timestamp in microseconds since Unix epoch
captured_length: u32Captured length (may be less than original)
original_length: u32Original packet length on the wire
link_type: u16Link layer type (e.g., 1 = Ethernet)
data: BytesPacket data (potentially zero-copy with Bytes)
Implementations§
Source§impl RawPacket
impl RawPacket
Sourcepub fn new(
frame_number: u64,
timestamp_us: i64,
captured_length: u32,
original_length: u32,
link_type: u16,
data: Vec<u8>,
) -> Self
pub fn new( frame_number: u64, timestamp_us: i64, captured_length: u32, original_length: u32, link_type: u16, data: Vec<u8>, ) -> Self
Create a new raw packet from owned data.
Sourcepub fn from_bytes(
frame_number: u64,
timestamp_us: i64,
captured_length: u32,
original_length: u32,
link_type: u16,
data: Bytes,
) -> Self
pub fn from_bytes( frame_number: u64, timestamp_us: i64, captured_length: u32, original_length: u32, link_type: u16, data: Bytes, ) -> Self
Create a new raw packet from Bytes (zero-copy if already Bytes).
Sourcepub fn is_truncated(&self) -> bool
pub fn is_truncated(&self) -> bool
Check if the packet was truncated during capture.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RawPacket
impl RefUnwindSafe for RawPacket
impl Send for RawPacket
impl Sync for RawPacket
impl Unpin for RawPacket
impl UnwindSafe for RawPacket
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