pub struct AsyncPcapReader<R: AsyncRead + Unpin> { /* private fields */ }Implementations§
Source§impl<R: AsyncRead + Unpin> AsyncPcapReader<R>
impl<R: AsyncRead + Unpin> AsyncPcapReader<R>
Sourcepub async fn new(reader: R) -> Result<Self, PcapParseError>
pub async fn new(reader: R) -> Result<Self, PcapParseError>
Creates a new AsyncPcapReader from a reader
Returns Ok(Self) on success, or Err if there was an error
reading the file header
A buffer is allocated based on the snap length in the file header
Sourcepub fn file_header(&self) -> &PcapFileHeader
pub fn file_header(&self) -> &PcapFileHeader
Returns the file header of the pcap file
Sourcepub async fn next_packet(
&mut self,
) -> Result<Option<(PacketHeader, &[u8])>, PcapParseError>
pub async fn next_packet( &mut self, ) -> Result<Option<(PacketHeader, &[u8])>, PcapParseError>
Reads the next packet from the pcap file
Returns Ok(None) if there are no more packets to read
Returns Err if there was an error reading the packet
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for AsyncPcapReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for AsyncPcapReader<R>where
R: RefUnwindSafe,
impl<R> Send for AsyncPcapReader<R>where
R: Send,
impl<R> Sync for AsyncPcapReader<R>where
R: Sync,
impl<R> Unpin for AsyncPcapReader<R>
impl<R> UnwindSafe for AsyncPcapReader<R>where
R: UnwindSafe,
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