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

cleanup and optimize some code

This commit is contained in:
Nikolay Kim
2017-12-12 21:32:58 -08:00
parent ab6efd2421
commit 2e83c5924d
9 changed files with 148 additions and 68 deletions

View File

@@ -58,6 +58,7 @@ pub(crate) enum ReplyItem {
impl Reply {
/// Create actor response
#[inline]
pub fn actor<A, S>(ctx: HttpContext<A, S>) -> Reply
where A: Actor<Context=HttpContext<A, S>>, S: 'static
{
@@ -65,6 +66,7 @@ impl Reply {
}
/// Create async response
#[inline]
pub fn async<F>(fut: F) -> Reply
where F: Future<Item=HttpResponse, Error=Error> + 'static
{
@@ -72,10 +74,12 @@ impl Reply {
}
/// Send response
#[inline]
pub fn response<R: Into<HttpResponse>>(response: R) -> Reply {
Reply(ReplyItem::Message(response.into()))
}
#[inline]
pub(crate) fn into(self) -> ReplyItem {
self.0
}