Function ore::netio::read_exact_or_eof [−][src]
pub fn read_exact_or_eof<'a, A>(
reader: &'a mut A,
buf: &'a mut [u8]
) -> ReadExactOrEof<'a, A>ⓘNotable traits for ReadExactOrEof<'_, A>impl<A> Future for ReadExactOrEof<'_, A> where
A: AsyncRead + Unpin, type Output = Result<usize>;
where
A: AsyncRead,
This is supported on crate feature
network
only.Expand description
Creates a future which will read exactly enough bytes to fill buf
, unless
EOF is reached first. If a short read should be considered an error, use
tokio::io::AsyncReadExt::read_exact
instead.
The returned future will resolve to the number of bytes read.
In the case of an error the contents of the buffer are unspecified.