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

renamed Route::handler to Route::f, added Route::h to register Handler

This commit is contained in:
Nikolay Kim
2017-12-04 14:07:53 -08:00
parent 03f7d95d88
commit f5d6179a34
19 changed files with 79 additions and 40 deletions

View File

@@ -3,7 +3,7 @@
use http::{StatusCode, Error as HttpError};
use body::Body;
use route::{Reply, RouteHandler, FromRequest};
use route::{Reply, Handler, RouteHandler, FromRequest};
use httprequest::HttpRequest;
use httpresponse::{HttpResponse, HttpResponseBuilder};
@@ -67,6 +67,14 @@ impl StaticResponse {
}
}
impl<S> Handler<S> for StaticResponse {
type Result = HttpResponse;
fn handle(&self, _: HttpRequest<S>) -> HttpResponse {
HttpResponse::new(self.0, Body::Empty)
}
}
impl<S> RouteHandler<S> for StaticResponse {
fn handle(&self, _: HttpRequest<S>) -> Reply {
Reply::response(HttpResponse::new(self.0, Body::Empty))