pub struct PacketCapture { /* private fields */ }Implementations§
Source§impl PacketCapture
impl PacketCapture
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Open a capture file (supports both pcap and pcapng)
Sourcepub fn set_filter(&mut self, filter: &str) -> Result<()>
pub fn set_filter(&mut self, filter: &str) -> Result<()>
Apply a BPF filter (only works with pcap backend currently)
Sourcepub fn stats(&mut self) -> Result<CaptureStats>
pub fn stats(&mut self) -> Result<CaptureStats>
Get statistics about the capture file
Sourcepub fn process_packets<F>(&mut self, callback: F) -> Result<()>
pub fn process_packets<F>(&mut self, callback: F) -> Result<()>
Process packets with a callback function
Auto Trait Implementations§
impl !Sync for PacketCapture
impl Freeze for PacketCapture
impl RefUnwindSafe for PacketCapture
impl Send for PacketCapture
impl Unpin for PacketCapture
impl UnsafeUnpin for PacketCapture
impl UnwindSafe for PacketCapture
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more