refactor(lib): Remove uses of pin_project::project attribute (#2219)
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:
		| @@ -5,7 +5,7 @@ use std::time::Duration; | ||||
|  | ||||
| use h2::server::{Connection, Handshake, SendResponse}; | ||||
| use h2::Reason; | ||||
| use pin_project::{pin_project, project}; | ||||
| use pin_project::pin_project; | ||||
| use tokio::io::{AsyncRead, AsyncWrite}; | ||||
|  | ||||
| use super::{decode_content_length, ping, PipeToSendStream, SendBuf}; | ||||
| @@ -326,7 +326,7 @@ where | ||||
|     state: H2StreamState<F, B>, | ||||
| } | ||||
|  | ||||
| #[pin_project] | ||||
| #[pin_project(project = H2StreamStateProj)] | ||||
| enum H2StreamState<F, B> | ||||
| where | ||||
|     B: HttpBody, | ||||
| @@ -367,13 +367,11 @@ where | ||||
|     B::Error: Into<Box<dyn StdError + Send + Sync>>, | ||||
|     E: Into<Box<dyn StdError + Send + Sync>>, | ||||
| { | ||||
|     #[project] | ||||
|     fn poll2(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<crate::Result<()>> { | ||||
|         let mut me = self.project(); | ||||
|         loop { | ||||
|             #[project] | ||||
|             let next = match me.state.as_mut().project() { | ||||
|                 H2StreamState::Service(h) => { | ||||
|                 H2StreamStateProj::Service(h) => { | ||||
|                     let res = match h.poll(cx) { | ||||
|                         Poll::Ready(Ok(r)) => r, | ||||
|                         Poll::Pending => { | ||||
| @@ -417,7 +415,7 @@ where | ||||
|                         return Poll::Ready(Ok(())); | ||||
|                     } | ||||
|                 } | ||||
|                 H2StreamState::Body(pipe) => { | ||||
|                 H2StreamStateProj::Body(pipe) => { | ||||
|                     return pipe.poll(cx); | ||||
|                 } | ||||
|             }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user