1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

update new transform trait

This commit is contained in:
Nikolay Kim 2019-03-02 13:57:00 -08:00
parent cc20fee628
commit 75fbb97480
2 changed files with 6 additions and 7 deletions

View File

@ -1,8 +1,7 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use actix_http::{Error, Response}; use actix_http::{Error, Response};
use actix_service::{NewService, Service}; use actix_service::{NewService, Service, Void};
use actix_utils::Never;
use futures::future::{ok, FutureResult}; use futures::future::{ok, FutureResult};
use futures::{try_ready, Async, Future, IntoFuture, Poll}; use futures::{try_ready, Async, Future, IntoFuture, Poll};
@ -71,7 +70,7 @@ where
{ {
type Request = (T, HttpRequest); type Request = (T, HttpRequest);
type Response = ServiceResponse; type Response = ServiceResponse;
type Error = Never; type Error = Void;
type InitError = (); type InitError = ();
type Service = HandleService<F, T, R>; type Service = HandleService<F, T, R>;
type Future = FutureResult<Self::Service, ()>; type Future = FutureResult<Self::Service, ()>;
@ -101,7 +100,7 @@ where
{ {
type Request = (T, HttpRequest); type Request = (T, HttpRequest);
type Response = ServiceResponse; type Response = ServiceResponse;
type Error = Never; type Error = Void;
type Future = HandleServiceResponse<R::Future>; type Future = HandleServiceResponse<R::Future>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
@ -128,7 +127,7 @@ where
T::Error: Into<Error>, T::Error: Into<Error>,
{ {
type Item = ServiceResponse; type Item = ServiceResponse;
type Error = Never; type Error = Void;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
match self.fut.poll() { match self.fut.poll() {

View File

@ -47,7 +47,7 @@ where
} }
} }
impl<T, S> NewTransform<S> for MiddlewareFactory<T, S> impl<T, S, C> NewTransform<S, C> for MiddlewareFactory<T, S>
where where
T: Transform<S> + Clone, T: Transform<S> + Clone,
S: Service, S: Service,
@ -59,7 +59,7 @@ where
type InitError = (); type InitError = ();
type Future = FutureResult<Self::Transform, Self::InitError>; type Future = FutureResult<Self::Transform, Self::InitError>;
fn new_transform(&self) -> Self::Future { fn new_transform(&self, _: &C) -> Self::Future {
ok(self.tr.clone()) ok(self.tr.clone())
} }
} }