1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01:00

Merge pull request #1361 from Aaron1011/fix/connector-pool-support

Use #[pin_project] with `ConnectorPoolSupport`
This commit is contained in:
Yuki Okushi 2020-02-21 06:01:26 +09:00 committed by GitHub
commit b3f1071aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ use h2::client::{handshake, Connection, SendRequest};
use http::uri::Authority; use http::uri::Authority;
use indexmap::IndexSet; use indexmap::IndexSet;
use slab::Slab; use slab::Slab;
use pin_project::pin_project;
use super::connection::{ConnectionType, IoConnection}; use super::connection::{ConnectionType, IoConnection};
use super::error::ConnectError; use super::error::ConnectError;
@ -422,6 +423,7 @@ where
} }
} }
#[pin_project]
struct ConnectorPoolSupport<T, Io> struct ConnectorPoolSupport<T, Io>
where where
Io: AsyncRead + AsyncWrite + Unpin + 'static, Io: AsyncRead + AsyncWrite + Unpin + 'static,
@ -439,7 +441,7 @@ where
type Output = (); type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = unsafe { self.get_unchecked_mut() }; let this = self.project();
let mut inner = this.inner.as_ref().borrow_mut(); let mut inner = this.inner.as_ref().borrow_mut();
inner.waker.register(cx.waker()); inner.waker.register(cx.waker());