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()
}
}