1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +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

@ -165,7 +165,7 @@ struct ServiceResponse<F, I, E, B> {
_t: PhantomData<(I, E)>,
}
#[pin_project::pin_project]
#[pin_project::pin_project(project = ServiceResponseStateProj)]
enum ServiceResponseState<F, B> {
ServiceCall(#[pin] F, Option<SendResponse<Bytes>>),
SendPayload(SendStream<Bytes>, #[pin] ResponseBody<B>),
@ -245,13 +245,11 @@ where
{
type Output = ();
#[pin_project::project]
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut this = self.as_mut().project();
#[project]
match this.state.project() {
ServiceResponseState::ServiceCall(call, send) => match call.poll(cx) {
ServiceResponseStateProj::ServiceCall(call, send) => match call.poll(cx) {
Poll::Ready(Ok(res)) => {
let (res, body) = res.into().replace_body(());
@ -305,7 +303,7 @@ where
}
}
},
ServiceResponseState::SendPayload(ref mut stream, ref mut body) => loop {
ServiceResponseStateProj::SendPayload(ref mut stream, ref mut body) => loop {
loop {
if let Some(ref mut buffer) = this.buffer {
match stream.poll_capacity(cx) {