1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-23 08:35:13 +02:00

cleanup Unpin constraint; simplify Framed impl

This commit is contained in:
Nikolay Kim
2019-11-19 14:51:40 +06:00
parent 617e40a7e9
commit 3bf83c1d98
30 changed files with 493 additions and 1252 deletions

View File

@@ -44,8 +44,7 @@ where
impl<A, F, E> ServiceFactory for MapInitErr<A, F, E>
where
A: ServiceFactory,
A::Future: Unpin,
F: Fn(A::InitError) -> E + Unpin + Clone,
F: Fn(A::InitError) -> E + Clone,
{
type Request = A::Request;
type Response = A::Response;
@@ -61,12 +60,14 @@ where
}
}
#[pin_project::pin_project]
pub struct MapInitErrFuture<A, F, E>
where
A: ServiceFactory,
F: Fn(A::InitError) -> E,
{
f: F,
#[pin]
fut: A::Future,
}
@@ -83,13 +84,12 @@ where
impl<A, F, E> Future for MapInitErrFuture<A, F, E>
where
A: ServiceFactory,
A::Future: Unpin,
F: Fn(A::InitError) -> E + Unpin,
F: Fn(A::InitError) -> E,
{
type Output = Result<A::Service, E>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.get_mut();
Pin::new(&mut this.fut).poll(cx).map_err(&this.f)
let this = self.project();
this.fut.poll(cx).map_err(this.f)
}
}