pub fn read_to_bytes_rng<'a, R: AsyncRead + ?Sized + Unpin>(
    reader: &'a mut R,
    bytes: &'a mut BytesMut,
    rng: impl RangeBounds<usize>
) -> ReadToBytesRngFuture<'a, R> 
Available on crate feature bytes only.
Expand description
  • rng - The start of the range specify the minimum of bytes to read in, while the end of the range specify the maximum of bytes that can be read in. If the lower bound is not specified, it is default to 0. If the upper bound is not specified, it is default to the capacity of bytes. The lower bound must not be larger than the upper bound.

Return std::io::ErrorKind::UnexpectedEof on Eof.

NOTE that this function does not modify any existing data.

Cancel safety

It is cancel safe and dropping the returned future will not stop the wakeup from happening.