puzz_http/body/
next.rs

1use std::future::Future;
2use std::pin::Pin;
3use std::task;
4
5use bytes::Bytes;
6
7use super::Body;
8
9#[must_use = "futures don't do anything unless polled"]
10#[derive(Debug)]
11pub struct Next<'a, B: ?Sized>(pub(crate) &'a mut B);
12
13impl<'a, B: Body + Unpin + ?Sized> Future for Next<'a, B> {
14    type Output = Option<Result<Bytes, B::Error>>;
15
16    fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<Self::Output> {
17        Pin::new(&mut self.0).poll_next(cx)
18    }
19}