fix: Remove uses of pin_project::project attribute (#367)

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-09 13:09:35 -04:00
committed by GitHub
parent 4f839107b9
commit 5bda615632
4 changed files with 12 additions and 18 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ tower-service = "0.3"
tokio-util = { version = "0.3", features = ["codec"] }
async-stream = "0.2"
http-body = "0.3"
pin-project = "0.4"
pin-project = "0.4.17"
# prost
prost1 = { package = "prost", version = "0.6", optional = true }
+4 -6
View File
@@ -1,5 +1,5 @@
use crate::Error;
use pin_project::{pin_project, project};
use pin_project::pin_project;
use std::fmt;
use std::{
future::Future,
@@ -161,7 +161,7 @@ pub(crate) struct ResponseFuture<F, E> {
inner: Inner<F, E>,
}
#[pin_project]
#[pin_project(project = InnerProj)]
#[derive(Debug)]
enum Inner<F, E> {
Future(#[pin] F),
@@ -190,14 +190,12 @@ where
{
type Output = Result<T, Error>;
#[project]
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
//self.project().inner.poll(cx).map_err(Into::into)
let me = self.project();
#[project]
match me.inner.project() {
Inner::Future(fut) => fut.poll(cx).map_err(Into::into),
Inner::Error(e) => {
InnerProj::Future(fut) => fut.poll(cx).map_err(Into::into),
InnerProj::Error(e) => {
let e = e.take().expect("Polled after ready.").into();
Poll::Ready(Err(e))
}