[][src]Struct pcap_file::pcap::Packet

pub struct Packet<'a> {
    pub header: PacketHeader,
    pub data: Cow<'a, [u8]>,
}

Packet with its header and data.

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]

pub fn new(
    ts_sec: u32,
    ts_nsec: u32,
    data: &'a [u8],
    orig_len: u32
) -> Packet<'a>
[src]

Create a new borrowed Packet with the given parameters.

pub fn new_owned(
    ts_sec: u32,
    ts_nsec: u32,
    data: Vec<u8>,
    orig_len: u32
) -> Packet<'static>
[src]

Create a new owned Packet with the given parameters.

pub fn from_reader<R: Read, B: ByteOrder>(
    reader: &mut R,
    ts_resolution: TsResolution
) -> Result<Packet<'static>, PcapError>
[src]

Create a new owned Packet from a reader.

pub fn from_slice<B: ByteOrder>(
    slice: &'a [u8],
    ts_resolution: TsResolution
) -> Result<(&'a [u8], Packet<'a>), PcapError>
[src]

Create a new borrowed Packet from a slice.

pub fn to_owned(&self) -> Packet<'static>[src]

Convert a borrowed Packet to an owned one.

Trait Implementations

impl<'a> Clone for Packet<'a>[src]

impl<'a> Debug for Packet<'a>[src]

Auto Trait Implementations

impl<'a> Send for Packet<'a>

impl<'a> Sync for Packet<'a>

impl<'a> Unpin for Packet<'a>

impl<'a> UnwindSafe for Packet<'a>

impl<'a> RefUnwindSafe for Packet<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]