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

use FromRequest instead of HttpRequestExtractor

This commit is contained in:
Nikolay Kim
2018-03-29 13:12:28 -07:00
parent dfd8f1058e
commit 86dd732704
8 changed files with 93 additions and 93 deletions

View File

@@ -30,6 +30,16 @@ pub trait Responder {
fn respond_to(self, req: HttpRequest) -> Result<Self::Item, Self::Error>;
}
/// Trait implemented by types that can be extracted from request.
///
/// Types that implement this trait can be used with `Route::with()` method.
pub trait FromRequest<S>: Sized where S: 'static
{
type Result: Future<Item=Self, Error=Error>;
fn from_request(req: &HttpRequest<S>) -> Self::Result;
}
/// Combines two different responder types into a single type
///
/// ```rust