mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-21 21:25:36 +02:00
fix drain support for actor; make pattern more reusable
This commit is contained in:
@@ -144,6 +144,7 @@ impl<T: Responder, E: Into<Error>> Responder for Result<T, E>
|
||||
}
|
||||
|
||||
impl<E: Into<Error>> From<Result<Reply, E>> for Reply {
|
||||
#[inline]
|
||||
fn from(res: Result<Reply, E>) -> Self {
|
||||
match res {
|
||||
Ok(val) => val,
|
||||
@@ -152,6 +153,23 @@ impl<E: Into<Error>> From<Result<Reply, E>> for Reply {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Into<Error>> From<Result<HttpResponse, E>> for Reply {
|
||||
#[inline]
|
||||
fn from(res: Result<HttpResponse, E>) -> Self {
|
||||
match res {
|
||||
Ok(val) => Reply(ReplyItem::Message(val)),
|
||||
Err(err) => Reply(ReplyItem::Message(err.into().into())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<Future<Item=HttpResponse, Error=Error>>> for Reply {
|
||||
#[inline]
|
||||
fn from(fut: Box<Future<Item=HttpResponse, Error=Error>>) -> Reply {
|
||||
Reply(ReplyItem::Future(fut))
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, E> Responder for Box<Future<Item=I, Error=E>>
|
||||
where I: Responder + 'static,
|
||||
E: Into<Error> + 'static
|
||||
|
Reference in New Issue
Block a user