Move handler definitions to top of file.

This commit is contained in:
Sergio Benitez 2017-09-24 20:13:38 -07:00
parent 237c673be4
commit a60c9e812e
1 changed files with 6 additions and 6 deletions

View File

@ -10,6 +10,12 @@ use outcome;
/// Type alias for the `Outcome` of a `Handler`. /// Type alias for the `Outcome` of a `Handler`.
pub type Outcome<'r> = outcome::Outcome<Response<'r>, Status, Data>; pub type Outcome<'r> = outcome::Outcome<Response<'r>, Status, Data>;
/// The type of a request handler.
pub type Handler = for<'r> fn(&'r Request, Data) -> Outcome<'r>;
/// The type of an error handler.
pub type ErrorHandler = for<'r> fn(Error, &'r Request) -> response::Result<'r>;
impl<'r> Outcome<'r> { impl<'r> Outcome<'r> {
/// Return the `Outcome` of response to `req` from `responder`. /// Return the `Outcome` of response to `req` from `responder`.
/// ///
@ -78,9 +84,3 @@ impl<'r> Outcome<'r> {
outcome::Outcome::Forward(data) outcome::Outcome::Forward(data)
} }
} }
/// The type of a request handler.
pub type Handler = for<'r> fn(&'r Request, Data) -> Outcome<'r>;
/// The type of an error handler.
pub type ErrorHandler = for<'r> fn(Error, &'r Request) -> response::Result<'r>;