[−][src]Struct pcarp::Capture
A packet capture which can be iterated over.
There are two APIs here:
- Iterator style:
next
- Streaming-iterator style:
advance
/get
The streaming iterator API is slightly more general when the items are
borrowed. I expect that most users will just use next()
, but users
needing to work around lifetime contraints may need to use advance/get
.
Nothing bad will happen if you mix these two APIs.
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]
'a: 'b,
Get the next packet.
This function is a wrapper around the lower-level API:
it simply calls advance()
then get()
.
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]
Auto Trait Implementations
impl<R> Send for Capture<R> where
R: Send,
R: Send,
impl<R> Sync for Capture<R> where
R: Sync,
R: Sync,
impl<R> Unpin for Capture<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for Capture<R> where
R: UnwindSafe,
R: UnwindSafe,
impl<R> RefUnwindSafe for Capture<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,