http_body_util/combinators/
frame.rs

1use http_body::Body;
2
3use core::future::Future;
4use core::pin::Pin;
5use 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`].
10pub struct Frame<'a, T: ?Sized>(pub(crate) &'a mut T);
11
12impl<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(ctx)
17    }
18}