1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-30 16:34:26 +02:00

Remove uses of pin_project::project attribute

pin-project will deprecate the project attribute due to some unfixable
limitations.

Refs: https://github.com/taiki-e/pin-project/issues/225
This commit is contained in:
Taiki Endo
2020-06-06 06:44:14 +09:00
parent a79450482c
commit 6c5c4ea230
10 changed files with 55 additions and 83 deletions

View File

@ -12,7 +12,7 @@ use actix_http::{Error, Response, ResponseBuilder};
use bytes::{Bytes, BytesMut};
use futures_util::future::{err, ok, Either as EitherFuture, Ready};
use futures_util::ready;
use pin_project::{pin_project, project};
use pin_project::pin_project;
use crate::request::HttpRequest;
@ -379,7 +379,7 @@ where
}
}
#[pin_project]
#[pin_project(project = EitherResponderProj)]
pub enum EitherResponder<A, B>
where
A: Responder,
@ -396,14 +396,12 @@ where
{
type Output = Result<Response, Error>;
#[project]
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
#[project]
match self.project() {
EitherResponder::A(fut) => {
EitherResponderProj::A(fut) => {
Poll::Ready(ready!(fut.poll(cx)).map_err(|e| e.into()))
}
EitherResponder::B(fut) => {
EitherResponderProj::B(fut) => {
Poll::Ready(ready!(fut.poll(cx).map_err(|e| e.into())))
}
}