async_ioutil/
read.rs

1use futures::{AsyncRead, AsyncReadExt};
2use std::io::Result;
3use std::marker::Unpin;
4
5/// Read all data into `Vec<u8>`.
6pub async fn read_all<R: AsyncRead + Unpin>(reader: &mut R) -> Result<Vec<u8>> {
7    let mut bytes: Vec<u8> = Vec::new();
8    reader.read_to_end(&mut bytes).await?;
9    Ok(bytes)
10}