1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

add appl builder async method; add async handler section

This commit is contained in:
Nikolay Kim
2017-12-01 21:58:19 -08:00
parent e6feec62a8
commit c3a0a4457a
4 changed files with 56 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ use http::Method;
use futures::Future;
use error::Error;
use route::{Reply, RouteHandler, WrapHandler, Handler, StreamHandler};
use route::{Reply, Handler, RouteHandler, AsyncHandler, WrapHandler};
use httprequest::HttpRequest;
use httpresponse::HttpResponse;
use httpcodes::{HTTPNotFound, HTTPMethodNotAllowed};
@@ -70,7 +70,7 @@ impl<S> Resource<S> where S: 'static {
where F: Fn(HttpRequest<S>) -> R + 'static,
R: Future<Item=HttpResponse, Error=Error> + 'static,
{
self.routes.insert(method, Box::new(StreamHandler::new(handler)));
self.routes.insert(method, Box::new(AsyncHandler::new(handler)));
}
/// Default handler is used if no matched route found.