mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 09:59:21 +02:00
better handler result handling
This commit is contained in:
@ -148,9 +148,7 @@ impl<S> ApplicationBuilder<S> where S: 'static {
|
||||
/// let app = Application::default("/")
|
||||
/// .resource("/test", |r| {
|
||||
/// r.get::<MyRoute>();
|
||||
/// r.handler(Method::HEAD, |req| {
|
||||
/// Ok(httpcodes::HTTPMethodNotAllowed)
|
||||
/// });
|
||||
/// r.handler(Method::HEAD, |req| httpcodes::HTTPMethodNotAllowed);
|
||||
/// })
|
||||
/// .finish();
|
||||
/// }
|
||||
|
@ -205,11 +205,11 @@ impl HttpResponse {
|
||||
}
|
||||
|
||||
/// Helper conversion implementation
|
||||
impl<I: Into<HttpResponse>, E: Into<HttpResponse>> From<Result<I, E>> for HttpResponse {
|
||||
impl<I: Into<HttpResponse>, E: Into<Error>> From<Result<I, E>> for HttpResponse {
|
||||
fn from(res: Result<I, E>) -> Self {
|
||||
match res {
|
||||
Ok(val) => val.into(),
|
||||
Err(err) => err.into(),
|
||||
Err(err) => err.into().into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user