1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-28 07:30:36 +02:00

remove pin-project; update Unpin consrtaint

This commit is contained in:
Nikolay Kim
2019-11-18 18:28:54 +06:00
parent 7404d82a9b
commit 1354946460
22 changed files with 225 additions and 161 deletions

View File

@ -40,7 +40,6 @@ actix-rt = "1.0.0-alpha.1"
derive_more = "0.15"
either = "1.5.2"
futures = "0.3.1"
pin-project = "0.4.5"
http = { version = "0.1.17", optional = true }
log = "0.4"
tokio-net = "=0.2.0-alpha.6"

View File

@ -8,7 +8,6 @@ use std::task::{Context, Poll};
use actix_service::{Service, ServiceFactory};
use futures::future::{err, ok, BoxFuture, Either, FutureExt, Ready};
use pin_project::pin_project;
use tokio_net::tcp::TcpStream;
use super::connect::{Address, Connect, Connection};
@ -94,7 +93,6 @@ impl<T: Address> Service for TcpConnector<T> {
}
}
#[pin_project]
#[doc(hidden)]
/// Tcp stream connector response future
pub struct TcpConnectorResponse<T> {
@ -137,7 +135,7 @@ impl<T: Address> Future for TcpConnectorResponse<T> {
type Output = Result<Connection<T, TcpStream>, ConnectError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.project();
let this = self.get_mut();
// connect
loop {
@ -167,7 +165,7 @@ impl<T: Address> Future for TcpConnectorResponse<T> {
// try to connect
let addr = this.addrs.as_mut().unwrap().pop_front().unwrap();
*this.stream = Some(TcpStream::connect(addr).boxed());
this.stream = Some(TcpStream::connect(addr).boxed());
}
}
}

View File

@ -6,7 +6,6 @@ use std::task::{Context, Poll};
use actix_service::{Service, ServiceFactory};
use futures::future::{ok, Either, Ready};
use pin_project::pin_project;
use trust_dns_resolver::lookup_ip::LookupIpFuture;
use trust_dns_resolver::{AsyncResolver, Background};
@ -129,12 +128,10 @@ impl<T: Address> Service for Resolver<T> {
}
}
#[pin_project]
#[doc(hidden)]
/// Resolver future
pub struct ResolverFuture<T: Address> {
req: Option<Connect<T>>,
#[pin]
lookup: Background<LookupIpFuture>,
}
@ -157,9 +154,9 @@ impl<T: Address> Future for ResolverFuture<T> {
type Output = Result<Connect<T>, ConnectError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.project();
let this = self.get_mut();
match this.lookup.poll(cx) {
match Pin::new(&mut this.lookup).poll(cx) {
Poll::Pending => Poll::Pending,
Poll::Ready(Ok(ips)) => {
let req = this.req.take().unwrap();