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

use Result intead of HandlerResult

This commit is contained in:
Nikolay Kim
2017-11-18 06:50:07 -10:00
parent c800bf55f5
commit a87784ba15
4 changed files with 6 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ use http::Method;
use futures::Stream;
use task::Task;
use error::Error;
use error::{Result, Error};
use route::{Route, RouteHandler, RouteResult, Frame, FnHandler, StreamHandler};
use payload::Payload;
use context::HttpContext;
@@ -16,9 +16,6 @@ use httprequest::HttpRequest;
use httpresponse::HttpResponse;
use httpcodes::{HTTPNotFound, HTTPMethodNotAllowed};
/// Result of a resource handler function
pub type HandlerResult<T> = Result<T, Error>;
/// Http resource
///
/// `Resource` is an entry in route table which corresponds to requested URL.
@@ -69,7 +66,7 @@ impl<S> Resource<S> where S: 'static {
/// Register handler for specified method.
pub fn handler<F, R>(&mut self, method: Method, handler: F)
where F: Fn(&mut HttpRequest, Payload, &S) -> HandlerResult<R> + 'static,
where F: Fn(&mut HttpRequest, Payload, &S) -> Result<R> + 'static,
R: Into<HttpResponse> + 'static,
{
self.routes.insert(method, Box::new(FnHandler::new(handler)));