tower_http_util/body/
into_buf_stream.rs1use futures::Poll;
2use http_body::Body;
3use tokio_buf::{BufStream, SizeHint};
4
5#[derive(Debug)]
11pub struct IntoBufStream<T> {
12 inner: T,
13}
14
15impl<T> IntoBufStream<T> {
16 pub(crate) fn new(inner: T) -> IntoBufStream<T> {
17 IntoBufStream { inner }
18 }
19}
20
21impl<T> BufStream for IntoBufStream<T>
22where
23 T: Body,
24{
25 type Item = T::Data;
26 type Error = T::Error;
27
28 fn poll_buf(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
29 self.inner.poll_data()
30 }
31
32 fn size_hint(&self) -> SizeHint {
33 self.inner.size_hint()
34 }
35}