1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-28 01:52:57 +01:00

do not constrain InitError for from_err new service

This commit is contained in:
Nikolay Kim 2018-09-17 18:49:55 -07:00
parent 118bfe5c14
commit 90ad1b12a8
2 changed files with 8 additions and 8 deletions

View File

@ -89,7 +89,7 @@ pub struct FromErrNewService<A, E> {
impl<A, E> FromErrNewService<A, E> impl<A, E> FromErrNewService<A, E>
where where
A: NewService, A: NewService,
E: From<A::Error> + From<A::InitError>, E: From<A::Error>,
{ {
/// Create new `FromErr` new service instance /// Create new `FromErr` new service instance
pub fn new(a: A) -> Self { pub fn new(a: A) -> Self {
@ -100,7 +100,7 @@ where
impl<A, E> Clone for FromErrNewService<A, E> impl<A, E> Clone for FromErrNewService<A, E>
where where
A: NewService + Clone, A: NewService + Clone,
E: From<A::Error> + From<A::InitError>, E: From<A::Error>,
{ {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self { Self {
@ -113,14 +113,14 @@ where
impl<A, E> NewService for FromErrNewService<A, E> impl<A, E> NewService for FromErrNewService<A, E>
where where
A: NewService, A: NewService,
E: From<A::Error> + From<A::InitError>, E: From<A::Error>,
{ {
type Request = A::Request; type Request = A::Request;
type Response = A::Response; type Response = A::Response;
type Error = E; type Error = E;
type Service = FromErr<A::Service, E>; type Service = FromErr<A::Service, E>;
type InitError = E; type InitError = A::InitError;
type Future = FromErrNewServiceFuture<A, E>; type Future = FromErrNewServiceFuture<A, E>;
fn new_service(&self) -> Self::Future { fn new_service(&self) -> Self::Future {
@ -134,7 +134,7 @@ where
pub struct FromErrNewServiceFuture<A, E> pub struct FromErrNewServiceFuture<A, E>
where where
A: NewService, A: NewService,
E: From<A::Error> + From<A::InitError>, E: From<A::Error>,
{ {
fut: A::Future, fut: A::Future,
e: PhantomData<E>, e: PhantomData<E>,
@ -143,10 +143,10 @@ where
impl<A, E> Future for FromErrNewServiceFuture<A, E> impl<A, E> Future for FromErrNewServiceFuture<A, E>
where where
A: NewService, A: NewService,
E: From<A::Error> + From<A::InitError>, E: From<A::Error>,
{ {
type Item = FromErr<A::Service, E>; type Item = FromErr<A::Service, E>;
type Error = E; type Error = A::InitError;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if let Async::Ready(service) = self.fut.poll()? { if let Async::Ready(service) = self.fut.poll()? {

View File

@ -141,7 +141,7 @@ pub trait NewServiceExt: NewService {
fn from_err<E>(self) -> FromErrNewService<Self, E> fn from_err<E>(self) -> FromErrNewService<Self, E>
where where
Self: Sized, Self: Sized,
E: From<Self::Error> + From<Self::InitError>, E: From<Self::Error>,
{ {
FromErrNewService::new(self) FromErrNewService::new(self)
} }