Skip to main content

AsyncReadWith

Trait AsyncReadWith 

Source
pub trait AsyncReadWith<'a> {
    type ReadFuture: CompletionFuture<Output = Result<()>>;

    // Required method
    fn read(&'a mut self, buf: ReadBufMut<'a>) -> Self::ReadFuture;
}
Expand description

Read bytes from a source asynchronously with a specific lifetime.

Required Associated Types§

Source

type ReadFuture: CompletionFuture<Output = Result<()>>

The future that reads from the source.

Required Methods§

Source

fn read(&'a mut self, buf: ReadBufMut<'a>) -> Self::ReadFuture

Pull some bytes from this source into the specified buffer.

If this reads 0 bytes of data, either the buffer was 0 bytes in length or the stream has reached EOF.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, 's> AsyncReadWith<'a> for &'s [u8]

Source§

type ReadFuture = ReadSlice<'a, 's>

Source§

fn read(&'a mut self, buf: ReadBufMut<'a>) -> Self::ReadFuture

Source§

impl<'a, R: AsyncReadWith<'a> + ?Sized> AsyncReadWith<'a> for &mut R

Source§

type ReadFuture = <R as AsyncReadWith<'a>>::ReadFuture

Source§

fn read(&'a mut self, buf: ReadBufMut<'a>) -> Self::ReadFuture

Source§

impl<'a, R: AsyncReadWith<'a> + ?Sized> AsyncReadWith<'a> for Box<R>

Source§

type ReadFuture = <R as AsyncReadWith<'a>>::ReadFuture

Source§

fn read(&'a mut self, buf: ReadBufMut<'a>) -> Self::ReadFuture

Source§

impl<'a, T: AsRef<[u8]>> AsyncReadWith<'a> for Cursor<T>

Source§

type ReadFuture = ReadCursor<'a, T>

Source§

fn read(&'a mut self, buf: ReadBufMut<'a>) -> Self::ReadFuture

Source§

impl<'a> AsyncReadWith<'a> for Empty

Source§

type ReadFuture = Ready<Result<(), Error>>

Source§

fn read(&'a mut self, _buf: ReadBufMut<'a>) -> Self::ReadFuture

Source§

impl<'a> AsyncReadWith<'a> for Repeat

Source§

type ReadFuture = ReadRepeat<'a>

Source§

fn read(&'a mut self, buf: ReadBufMut<'a>) -> Self::ReadFuture

Implementors§