#[throws(ReadLimitedError)]
pub async fn read_limited_bytes<S>(limit: usize, initial: Box<[u8]>,
#[throws(ReadLimitedError)]
pub async fn read_limited_bytes<S>(limit: usize, initial: Box<[u8]>,
stream: &mut S) -> Box<[u8]>
where S: futures::Stream<Item=Result<hyper::body::Bytes,hyper::Error>>
+ Debug + Unpin,
// we also require that the Stream is cancellation-safe
{
let mut accum = initial.into_vec();
stream: &mut S) -> Box<[u8]>
where S: futures::Stream<Item=Result<hyper::body::Bytes,hyper::Error>>
+ Debug + Unpin,
// we also require that the Stream is cancellation-safe
{
let mut accum = initial.into_vec();