diff --git a/examples/src/hyper_warp/server.rs b/examples/src/hyper_warp/server.rs index 931dcd5..7c54b1e 100644 --- a/examples/src/hyper_warp/server.rs +++ b/examples/src/hyper_warp/server.rs @@ -6,7 +6,6 @@ use futures::future::{self, Either, TryFutureExt}; use http::version::Version; use hyper::{service::make_service_fn, Server}; -use pin_project::pin_project; use std::convert::Infallible; use std::{ pin::Pin, @@ -77,16 +76,15 @@ async fn main() -> Result<(), Box> { Ok(()) } -#[pin_project(project = EitherBodyProj)] enum EitherBody { - Left(#[pin] A), - Right(#[pin] B), + Left(A), + Right(B), } impl http_body::Body for EitherBody where - A: http_body::Body + Send, - B: http_body::Body + Send, + A: http_body::Body + Send + Unpin, + B: http_body::Body + Send + Unpin, A::Error: Into, B::Error: Into, { @@ -104,9 +102,9 @@ where self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll>> { - match self.project() { - EitherBodyProj::Left(b) => b.poll_data(cx).map(map_option_err), - EitherBodyProj::Right(b) => b.poll_data(cx).map(map_option_err), + match self.get_mut() { + EitherBody::Left(b) => Pin::new(b).poll_data(cx).map(map_option_err), + EitherBody::Right(b) => Pin::new(b).poll_data(cx).map(map_option_err), } } @@ -114,9 +112,9 @@ where self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, Self::Error>> { - match self.project() { - EitherBodyProj::Left(b) => b.poll_trailers(cx).map_err(Into::into), - EitherBodyProj::Right(b) => b.poll_trailers(cx).map_err(Into::into), + match self.get_mut() { + EitherBody::Left(b) => Pin::new(b).poll_trailers(cx).map_err(Into::into), + EitherBody::Right(b) => Pin::new(b).poll_trailers(cx).map_err(Into::into), } } }