diff --git a/middleware/src/redirect.rs b/middleware/src/redirect.rs index 670caa4a..f5c0e61e 100644 --- a/middleware/src/redirect.rs +++ b/middleware/src/redirect.rs @@ -1,6 +1,6 @@ use actix_service::{Service, Transform}; use actix_web::dev::{ServiceRequest, ServiceResponse}; -use actix_web::{http, HttpResponse}; +use actix_web::{http, Error, HttpResponse}; use futures::future::{ok, Either, FutureResult}; use futures::Poll; @@ -8,12 +8,12 @@ pub struct CheckLogin; impl Transform for CheckLogin where - S: Service>, + S: Service, Error = Error>, S::Future: 'static, { type Request = ServiceRequest; type Response = ServiceResponse; - type Error = S::Error; + type Error = Error; type InitError = (); type Transform = CheckLoginMiddleware; type Future = FutureResult; @@ -28,12 +28,12 @@ pub struct CheckLoginMiddleware { impl Service for CheckLoginMiddleware where - S: Service>, + S: Service, Error = Error>, S::Future: 'static, { type Request = ServiceRequest; type Response = ServiceResponse; - type Error = S::Error; + type Error = Error; type Future = Either>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { diff --git a/middleware/src/simple.rs b/middleware/src/simple.rs index 277257e4..faf04cfb 100644 --- a/middleware/src/simple.rs +++ b/middleware/src/simple.rs @@ -1,5 +1,5 @@ use actix_service::{Service, Transform}; -use actix_web::dev::{ServiceRequest, ServiceResponse}; +use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error}; use futures::future::{ok, FutureResult}; use futures::{Future, Poll}; @@ -14,14 +14,13 @@ pub struct SayHi; // `B` - type of response's body impl Transform for SayHi where - S: Service>, + S: Service, Error = Error>, S::Future: 'static, - S::Error: 'static, B: 'static, { type Request = ServiceRequest; type Response = ServiceResponse; - type Error = S::Error; + type Error = Error; type InitError = (); type Transform = SayHiMiddleware; type Future = FutureResult; @@ -37,14 +36,13 @@ pub struct SayHiMiddleware { impl Service for SayHiMiddleware where - S: Service>, + S: Service, Error = Error>, S::Future: 'static, - S::Error: 'static, B: 'static, { type Request = ServiceRequest; type Response = ServiceResponse; - type Error = S::Error; + type Error = Error; type Future = Box>; fn poll_ready(&mut self) -> Poll<(), Self::Error> {