mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 00:50:20 +02:00
refactor reply handling
This commit is contained in:
@@ -14,8 +14,8 @@ use actix::dev::{AsyncContextApi, ActorAddressCell, ActorItemsCell, ActorWaitCel
|
||||
|
||||
use task::{IoContext, DrainFut};
|
||||
use body::Binary;
|
||||
use error::Error;
|
||||
use route::{Route, Frame};
|
||||
use error::{Error, Result as ActixResult};
|
||||
use route::{Route, Frame, Reply};
|
||||
use httpresponse::HttpResponse;
|
||||
|
||||
|
||||
@@ -158,6 +158,11 @@ impl<A> HttpContext<A> where A: Actor<Context=Self> + Route {
|
||||
pub fn connected(&self) -> bool {
|
||||
!self.disconnected
|
||||
}
|
||||
|
||||
pub fn reply(mut self, actor: A) -> ActixResult<Reply> {
|
||||
self.set_actor(actor);
|
||||
Reply::async(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<A> HttpContext<A> where A: Actor<Context=Self> + Route {
|
||||
|
Reference in New Issue
Block a user