Trait AsyncReadUtil

Source
pub trait AsyncReadUtil: AsyncRead + Sized {
    // Required methods
    fn observe<F: FnMut(&[u8])>(self, f: F) -> ObservedReader<Self, F>;
    fn map_read<F>(self, f: F) -> MappedReader<Self, F>
       where F: FnMut(&[u8], &mut [u8]) -> (usize, usize);
    fn buffered(self) -> BufReader<Self>;
}
Expand description

Convenience trait to apply the utility functions to types implementing futures::AsyncRead.

Required Methods§

Source

fn observe<F: FnMut(&[u8])>(self, f: F) -> ObservedReader<Self, F>

Observe the bytes being read from self using the provided closure. Refer to crate::ObservedReader for more info.

Source

fn map_read<F>(self, f: F) -> MappedReader<Self, F>
where F: FnMut(&[u8], &mut [u8]) -> (usize, usize),

Map the bytes being read from self into a new buffer using the provided closure. Refer to crate::MappedReader for more info.

Source

fn buffered(self) -> BufReader<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§