Struct InspectReader

struct InspectReader<R, F> { ... }

An adapter that lets you inspect the data that's being read.

This is useful for things like hashing data as it's read in.

Implementations

impl<R, F> InspectReader<R, F>

fn new(reader: R, f: F) -> InspectReader<R, F>
where
    R: AsyncRead,
    F: FnMut(&[u8])

Create a new InspectReader, wrapping reader and calling f for the new data supplied by each read call.

The closure will only be called with an empty slice if the inner reader returns without reading data into the buffer. This happens at EOF, or if poll_read is called with a zero-size buffer.

fn into_inner(self: Self) -> R

Consumes the InspectReader, returning the wrapped reader

impl<'__pin, R, F> Unpin for InspectReader<R, F>

impl<R> AsyncReadExt for InspectReader<R, F>

impl<R, F> Freeze for InspectReader<R, F>

impl<R, F> RefUnwindSafe for InspectReader<R, F>

impl<R, F> Send for InspectReader<R, F>

impl<R, F> Sync for InspectReader<R, F>

impl<R, F> UnsafeUnpin for InspectReader<R, F>

impl<R, F> UnwindSafe for InspectReader<R, F>

impl<R: AsyncRead, F: FnMut(&[u8])> AsyncRead for InspectReader<R, F>

fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<Result<()>>

impl<R: AsyncWrite, F> AsyncWrite for InspectReader<R, F>

fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize, Error>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize>>
fn is_write_vectored(self: &Self) -> bool

impl<T> Any for InspectReader<R, F>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for InspectReader<R, F>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for InspectReader<R, F>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for InspectReader<R, F>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for InspectReader<R, F>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for InspectReader<R, F>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for InspectReader<R, F>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<W> AsyncWriteExt for InspectReader<R, F>