[][src]Struct pcarp::Capture

pub struct Capture<R> { /* fields omitted */ }

A packet capture which can be iterated over.

Methods

impl<R: Read> Capture<R>[src]

pub fn new(rdr: R) -> Result<Capture<R>, Error>[src]

Create a new Capture.

pub fn next<'a, 'b>(&'a mut self) -> Option<Result<Packet<'b>, Error>> where
    'a: 'b, 
[src]

Get the next packet.

This function is just a convenient wrapper around the lower-level API: it simply calls advance() followed by get(). It's expected that most users will just use next(), but that users needing to work around lifetime contraints will need to use advance/get. Nothing bad will happen if you mix these two APIs.

pub fn advance(&mut self) -> Result<(), Error>[src]

Parse the next packet from the pcap file.

This function parses the packet but doesn't return it. Use get() to see the results.

pub fn get(&self) -> Option<Packet>[src]

Peek the current packet.

This function is cheap, since Packet holds a reference to the internal buffer and no pcap data is copied. When you're done with this packet and want to see the next one, use advance() to move on.

impl<R: Read + Seek> Capture<R>[src]

pub fn rewind(&mut self) -> Result<(), Error>[src]

Rewind to the beginning of the pcapng file

Auto Trait Implementations

impl<R> Send for Capture<R> where
    R: Send

impl<R> Sync for Capture<R> where
    R: Sync

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.