Skip to main content

hyper_utils/http_body_util/combinators/
frame.rs

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