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
30
31
32
33
34
35
use futures::Poll;
use http_body::Body;
use tokio_buf::{BufStream, SizeHint};
#[derive(Debug)]
pub struct IntoBufStream<T> {
inner: T,
}
impl<T> IntoBufStream<T> {
pub(crate) fn new(inner: T) -> IntoBufStream<T> {
IntoBufStream { inner }
}
}
impl<T> BufStream for IntoBufStream<T>
where
T: Body,
{
type Item = T::Data;
type Error = T::Error;
fn poll_buf(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
self.inner.poll_data()
}
fn size_hint(&self) -> SizeHint {
self.inner.size_hint()
}
}