1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-20 12:45:41 +02:00

use response instead of result for asyn c handlers

This commit is contained in:
Nikolay Kim
2019-11-21 15:01:34 +06:00
parent 55698f2524
commit 53c5151692
5 changed files with 43 additions and 59 deletions

View File

@@ -264,13 +264,12 @@ where
/// App::new().service(web::resource("/").route(web::route().to_async(index)));
/// ```
#[allow(clippy::wrong_self_convention)]
pub fn to_async<F, I, R, O, E>(mut self, handler: F) -> Self
pub fn to_async<F, I, R, U>(mut self, handler: F) -> Self
where
F: AsyncFactory<I, R, O, E>,
F: AsyncFactory<I, R, U>,
I: FromRequest + 'static,
R: Future<Output = Result<O, E>> + 'static,
O: Responder + 'static,
E: Into<Error> + 'static,
R: Future<Output = U> + 'static,
U: Responder + 'static,
{
self.routes.push(Route::new().to_async(handler));
self