mirror of https://github.com/fafhrd91/actix-web
add type bound to App::wrap and wrap_fn
This commit is contained in:
parent
2cbfae9685
commit
ac9d5c32f7
28
src/app.rs
28
src/app.rs
|
@ -51,10 +51,7 @@ impl App<AppEntry> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> App<T>
|
impl<T> App<T> {
|
||||||
where
|
|
||||||
T: ServiceFactory<ServiceRequest, Error = Error, Config = (), InitError = ()>,
|
|
||||||
{
|
|
||||||
/// Set application (root level) data.
|
/// Set application (root level) data.
|
||||||
///
|
///
|
||||||
/// Application data stored with `App::app_data()` method is available through the
|
/// Application data stored with `App::app_data()` method is available through the
|
||||||
|
@ -353,7 +350,7 @@ where
|
||||||
/// .route("/index.html", web::get().to(index));
|
/// .route("/index.html", web::get().to(index));
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn wrap<M, B1>(
|
pub fn wrap<M, B, B1>(
|
||||||
self,
|
self,
|
||||||
mw: M,
|
mw: M,
|
||||||
) -> App<
|
) -> App<
|
||||||
|
@ -366,6 +363,14 @@ where
|
||||||
>,
|
>,
|
||||||
>
|
>
|
||||||
where
|
where
|
||||||
|
T: ServiceFactory<
|
||||||
|
ServiceRequest,
|
||||||
|
Response = ServiceResponse<B>,
|
||||||
|
Error = Error,
|
||||||
|
Config = (),
|
||||||
|
InitError = (),
|
||||||
|
>,
|
||||||
|
B: MessageBody,
|
||||||
M: Transform<
|
M: Transform<
|
||||||
T::Service,
|
T::Service,
|
||||||
ServiceRequest,
|
ServiceRequest,
|
||||||
|
@ -373,6 +378,7 @@ where
|
||||||
Error = Error,
|
Error = Error,
|
||||||
InitError = (),
|
InitError = (),
|
||||||
>,
|
>,
|
||||||
|
B1: MessageBody,
|
||||||
{
|
{
|
||||||
App {
|
App {
|
||||||
endpoint: apply(mw, self.endpoint),
|
endpoint: apply(mw, self.endpoint),
|
||||||
|
@ -416,7 +422,7 @@ where
|
||||||
/// .route("/index.html", web::get().to(index));
|
/// .route("/index.html", web::get().to(index));
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn wrap_fn<B1, F, R>(
|
pub fn wrap_fn<F, R, B, B1>(
|
||||||
self,
|
self,
|
||||||
mw: F,
|
mw: F,
|
||||||
) -> App<
|
) -> App<
|
||||||
|
@ -429,9 +435,17 @@ where
|
||||||
>,
|
>,
|
||||||
>
|
>
|
||||||
where
|
where
|
||||||
B1: MessageBody,
|
T: ServiceFactory<
|
||||||
|
ServiceRequest,
|
||||||
|
Response = ServiceResponse<B>,
|
||||||
|
Error = Error,
|
||||||
|
Config = (),
|
||||||
|
InitError = (),
|
||||||
|
>,
|
||||||
|
B: MessageBody,
|
||||||
F: Fn(ServiceRequest, &T::Service) -> R + Clone,
|
F: Fn(ServiceRequest, &T::Service) -> R + Clone,
|
||||||
R: Future<Output = Result<ServiceResponse<B1>, Error>>,
|
R: Future<Output = Result<ServiceResponse<B1>, Error>>,
|
||||||
|
B1: MessageBody,
|
||||||
{
|
{
|
||||||
App {
|
App {
|
||||||
endpoint: apply_fn_factory(self.endpoint, mw),
|
endpoint: apply_fn_factory(self.endpoint, mw),
|
||||||
|
|
Loading…
Reference in New Issue