diff --git a/src/app.rs b/src/app.rs index 99c1c2586..ab2081c18 100644 --- a/src/app.rs +++ b/src/app.rs @@ -51,10 +51,7 @@ impl App { } } -impl App -where - T: ServiceFactory, -{ +impl App { /// Set application (root level) data. /// /// Application data stored with `App::app_data()` method is available through the @@ -353,7 +350,7 @@ where /// .route("/index.html", web::get().to(index)); /// } /// ``` - pub fn wrap( + pub fn wrap( self, mw: M, ) -> App< @@ -366,6 +363,14 @@ where >, > where + T: ServiceFactory< + ServiceRequest, + Response = ServiceResponse, + Error = Error, + Config = (), + InitError = (), + >, + B: MessageBody, M: Transform< T::Service, ServiceRequest, @@ -373,6 +378,7 @@ where Error = Error, InitError = (), >, + B1: MessageBody, { App { endpoint: apply(mw, self.endpoint), @@ -416,7 +422,7 @@ where /// .route("/index.html", web::get().to(index)); /// } /// ``` - pub fn wrap_fn( + pub fn wrap_fn( self, mw: F, ) -> App< @@ -429,9 +435,17 @@ where >, > where - B1: MessageBody, + T: ServiceFactory< + ServiceRequest, + Response = ServiceResponse, + Error = Error, + Config = (), + InitError = (), + >, + B: MessageBody, F: Fn(ServiceRequest, &T::Service) -> R + Clone, R: Future, Error>>, + B1: MessageBody, { App { endpoint: apply_fn_factory(self.endpoint, mw),