-
Notifications
You must be signed in to change notification settings - Fork 656
Open
Labels
Description
Hi,
When reading a known number of bytes from futures::io::ReadAsync
, it is useful to use the idiom
let mut a = vec![];
a.try_reserve(length0)?;
reader
.by_ref()
.take(length0 as u64)
.read_to_end(a)
.await?;
a.clear();
a.try_reserve(length1)?;
reader
.by_ref()
.take(length1 as u64)
.read_to_end(a)
.await?;
however, this is currently not possible because by_ref
does not exist like Read::by_ref
. This makes it impossible to implement the idiom above.
The proposal is to add such method. Alternatively, any way of doing the above? ^^