Struct pcap_file::packet::Packet
[−]
[src]
pub struct Packet<'a> { pub header: PacketHeader, pub data: Cow<'a, [u8]>, }
Describes a pcap packet.
The payload can be owned or borrowed.
Fields
header: PacketHeader
Header of the packet
data: Cow<'a, [u8]>
Payload, owned or borrowed, of the packet
Methods
impl<'a> Packet<'a>
[src]
fn new(ts_sec: u32, ts_usec: u32, len: u32, data: &'a [u8]) -> Packet<'a>
Create a new Packet
with the given parameters.
It borrows its payload
fn new_owned(
ts_sec: u32,
ts_usec: u32,
len: u32,
data: Vec<u8>
) -> Packet<'static>
ts_sec: u32,
ts_usec: u32,
len: u32,
data: Vec<u8>
) -> Packet<'static>
Create a new Packet
with the given parameters.
It owns its payload
fn from_reader<R: Read, B: ByteOrder>(
reader: &mut R
) -> ResultChain<Packet<'static>>
reader: &mut R
) -> ResultChain<Packet<'static>>
Create a new Packet
from a reader.
It owns its payload
fn from_slice<B: ByteOrder>(slice: &[u8]) -> ResultChain<Packet>
Create a new Packet
from a slice.
It borrows its payload
fn into_owned(self) -> Packet<'static>
Convert a borrowed Packet
to an owned one.
Trait Implementations
impl<'a> Clone for Packet<'a>
[src]
fn clone(&self) -> Packet<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more