AsyncRead

Trait AsyncRead 

Source
pub trait AsyncRead {
    // Required method
    async fn read<B>(&mut self, buf: B) -> BufResult<usize, B>
       where B: IoBufMut;

    // Provided method
    async fn read_vectored<V>(&mut self, buf: V) -> BufResult<usize, V>
       where V: IoVectoredBufMut { ... }
}
Available on crate feature io only.
Expand description

AsyncRead

Async read with a ownership of a buffer

Required Methods§

Source

async fn read<B>(&mut self, buf: B) -> BufResult<usize, B>
where B: IoBufMut,

Read some bytes from this source into the IoBufMut buffer and return a BufResult, consisting of the buffer and a usize indicating how many bytes were read.

§Caution
  • This function read data to the beginning of the buffer; that is, all existing data in the buffer will be overwritten. To read data to the end of the buffer, use AsyncReadExt::append.
  • Implementor MUST update the buffer init via SetLen::set_len after reading, and no further update should be made by caller.

Provided Methods§

Source

async fn read_vectored<V>(&mut self, buf: V) -> BufResult<usize, V>

Like read, except that it reads into a type implements IoVectoredBufMut.

The default implementation will read only to first buffer in buf with non-zero capacity and return, meaning it’s possible and likely that not all buffer space is filled. If guaranteed full read is desired, it is recommended to use AsyncReadExt::read_vectored_exact instead.

§Caution

Implementor MUST update the buffer init via SetLen::set_len after reading.

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.

Implementations on Foreign Types§

Source§

impl AsyncRead for &[u8]

Source§

async fn read<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBufMut,

Source§

async fn read_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>

Source§

impl<A> AsyncRead for &mut A
where A: AsyncRead + ?Sized,

Source§

async fn read<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBufMut,

Source§

async fn read_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>

Source§

impl<A> AsyncRead for Cursor<A>
where A: AsyncReadAt,

Source§

async fn read<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBufMut,

Source§

async fn read_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>

Implementors§

Source§

impl AsyncRead for &NamedPipeClient

Source§

impl AsyncRead for &NamedPipeServer

Source§

impl AsyncRead for &TcpStream

Source§

impl AsyncRead for &UnixStream

Source§

impl AsyncRead for NamedPipeClient

Source§

impl AsyncRead for NamedPipeServer

Source§

impl AsyncRead for Stdin

Source§

impl AsyncRead for TcpStream

Source§

impl AsyncRead for UnixStream

Source§

impl AsyncRead for ChildStderr

Source§

impl AsyncRead for ChildStdout

Source§

impl AsyncRead for RecvStream

Source§

impl AsyncRead for Null

Source§

impl AsyncRead for Repeat

Source§

impl<R> AsyncRead for BufReader<R>
where R: AsyncRead,

Source§

impl<R> AsyncRead for Take<R>
where R: AsyncRead,

Source§

impl<R, A> AsyncRead for Box<R, A>
where R: AsyncRead + ?Sized, A: Allocator,

Source§

impl<S> AsyncRead for MaybeTlsStream<S>
where S: AsyncRead + AsyncWrite + Unpin + 'static,

Source§

impl<S> AsyncRead for TlsStream<S>
where S: AsyncRead + AsyncWrite + 'static,

Source§

impl<T> AsyncRead for &AsyncFd<T>
where T: AsFd + 'static,

Source§

impl<T> AsyncRead for AsyncFd<T>
where T: AsFd + 'static,

Source§

impl<T> AsyncRead for OwnedReadHalf<T>
where &'a T: for<'a> AsyncRead,

Source§

impl<T> AsyncRead for compio::net::ReadHalf<'_, T>
where &'a T: for<'a> AsyncRead,

Source§

impl<T> AsyncRead for compio::io::util::split::ReadHalf<T>
where T: AsyncRead,