1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
mod req_body;
use bytes::Bytes;
use futures::{Stream, StreamExt};
pub use req_body::ReqBody;
pub use req_body::ReqBodySender;
use std::pin::Pin;
use std::task::{Context, Poll};
pub enum BodyError {}
pub struct Body<S: Stream> {
stream: S,
}
impl<S> Stream for Body<S>
where
S: Stream<Item = Result<Bytes, BodyError>> + Unpin,
{
type Item = Result<Bytes, BodyError>;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.stream.poll_next_unpin(cx)
}
fn size_hint(&self) -> (usize, Option<usize>) {
self.stream.size_hint()
}
}