pavex/request/body/
raw_body.rs1use std::pin::Pin;
2use std::task::{Context, Poll};
3
4use http_body::{Body, Frame};
5use hyper::body::Incoming;
6use pin_project_lite::pin_project;
7
8pin_project! {
9 #[derive(Debug)]
10
11 pub struct RawIncomingBody {
21 #[pin] inner: Incoming,
22 }
23}
24
25impl Body for RawIncomingBody {
27 type Data = <Incoming as Body>::Data;
28 type Error = <Incoming as Body>::Error;
29
30 fn poll_frame(
31 self: Pin<&mut Self>,
32 cx: &mut Context<'_>,
33 ) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
34 self.project().inner.poll_frame(cx)
35 }
36}
37
38impl From<Incoming> for RawIncomingBody {
39 fn from(inner: Incoming) -> Self {
40 Self { inner }
41 }
42}