diff --git a/src/handler.rs b/src/handler.rs index 3ac0c2ab2..661cd0285 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -353,13 +353,16 @@ impl> From> for AsyncResult { } } -impl> From>, E>> - for AsyncResult +impl From>, E>> for AsyncResult +where T: 'static, + E: Into + 'static { #[inline] - fn from(res: Result>, E>) -> Self { + fn from(res: Result>, E>) -> Self { match res { - Ok(fut) => AsyncResult(Some(AsyncResultItem::Future(fut))), + Ok(fut) => AsyncResult( + Some(AsyncResultItem::Future( + Box::new(fut.map_err(|e| e.into()))))), Err(err) => AsyncResult(Some(AsyncResultItem::Err(err.into()))), } }