1 | use http_body::Body; |
2 | |
3 | use core::future::Future; |
4 | use core::pin::Pin; |
5 | use core::task; |
6 | |
7 | #[must_use = "futures don't do anything unless polled" ] |
8 | #[derive (Debug)] |
9 | /// Future that resolves to the next frame from a [`Body`]. |
10 | pub struct Frame<'a, T: ?Sized>(pub(crate) &'a mut T); |
11 | |
12 | impl<T: Body + Unpin + ?Sized> Future for Frame<'_, T> { |
13 | type Output = Option<Result<http_body::Frame<T::Data>, T::Error>>; |
14 | |
15 | fn poll(mut self: Pin<&mut Self>, ctx: &mut task::Context<'_>) -> task::Poll<Self::Output> { |
16 | Pin::new(&mut self.0).poll_frame(cx:ctx) |
17 | } |
18 | } |
19 | |