mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
better ergonomics
This commit is contained in:
parent
26629aafa5
commit
cc3fbd27e0
@ -353,13 +353,16 @@ impl<T, E: Into<Error>> From<Result<T, E>> for AsyncResult<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, E: Into<Error>> From<Result<Box<Future<Item = T, Error = Error>>, E>>
|
||||
for AsyncResult<T>
|
||||
impl<T, E> From<Result<Box<Future<Item = T, Error = E>>, E>> for AsyncResult<T>
|
||||
where T: 'static,
|
||||
E: Into<Error> + 'static
|
||||
{
|
||||
#[inline]
|
||||
fn from(res: Result<Box<Future<Item = T, Error = Error>>, E>) -> Self {
|
||||
fn from(res: Result<Box<Future<Item = T, Error = E>>, 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()))),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user