1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 09:42:40 +01:00

update actix

This commit is contained in:
Nikolay Kim 2018-01-31 12:57:02 -08:00
parent 7e9fbfca72
commit 58f85658bd
2 changed files with 10 additions and 14 deletions

View File

@ -8,7 +8,7 @@ use smallvec::SmallVec;
use actix::{Actor, ActorState, ActorContext, AsyncContext, use actix::{Actor, ActorState, ActorContext, AsyncContext,
Address, SyncAddress, Handler, ResponseType, MessageResult, SpawnHandle}; Address, SyncAddress, Handler, ResponseType, MessageResult, SpawnHandle};
use actix::fut::ActorFuture; use actix::fut::ActorFuture;
use actix::dev::{AsyncContextApi, ContextImpl, Envelope, ToEnvelope, RemoteEnvelope}; use actix::dev::{ContextImpl, Envelope, ToEnvelope, RemoteEnvelope};
use body::{Body, Binary}; use body::{Body, Binary};
use error::{Error, ErrorInternalServerError}; use error::{Error, ErrorInternalServerError};
@ -81,14 +81,12 @@ impl<A, S> AsyncContext<A> for HttpContext<A, S> where A: Actor<Context=Self>
fn cancel_future(&mut self, handle: SpawnHandle) -> bool { fn cancel_future(&mut self, handle: SpawnHandle) -> bool {
self.inner.cancel_future(handle) self.inner.cancel_future(handle)
} }
}
#[doc(hidden)] #[doc(hidden)]
impl<A, S> AsyncContextApi<A> for HttpContext<A, S> where A: Actor<Context=Self> {
#[inline] #[inline]
fn unsync_address(&mut self) -> Address<A> { fn local_address(&mut self) -> Address<A> {
self.inner.unsync_address() self.inner.unsync_address()
} }
#[doc(hidden)]
#[inline] #[inline]
fn sync_address(&mut self) -> SyncAddress<A> { fn sync_address(&mut self) -> SyncAddress<A> {
self.inner.sync_address() self.inner.sync_address()
@ -211,7 +209,7 @@ impl<A, S> ToEnvelope<A> for HttpContext<A, S>
where A: Actor<Context=HttpContext<A, S>>, where A: Actor<Context=HttpContext<A, S>>,
{ {
#[inline] #[inline]
fn pack_msg<M>(msg: M, tx: Option<Sender<MessageResult<M>>>) -> Envelope<A> fn pack<M>(msg: M, tx: Option<Sender<MessageResult<M>>>) -> Envelope<A>
where A: Handler<M>, where A: Handler<M>,
M: ResponseType + Send + 'static, M::Item: Send, M::Error: Send M: ResponseType + Send + 'static, M::Item: Send, M::Error: Send
{ {

View File

@ -7,7 +7,7 @@ use smallvec::SmallVec;
use actix::{Actor, ActorState, ActorContext, AsyncContext, use actix::{Actor, ActorState, ActorContext, AsyncContext,
Address, SyncAddress, Handler, ResponseType, SpawnHandle, MessageResult}; Address, SyncAddress, Handler, ResponseType, SpawnHandle, MessageResult};
use actix::fut::ActorFuture; use actix::fut::ActorFuture;
use actix::dev::{AsyncContextApi, ContextImpl, Envelope, ToEnvelope, RemoteEnvelope}; use actix::dev::{ContextImpl, Envelope, ToEnvelope, RemoteEnvelope};
use body::{Body, Binary}; use body::{Body, Binary};
use error::{Error, ErrorInternalServerError}; use error::{Error, ErrorInternalServerError};
@ -64,16 +64,14 @@ impl<A, S> AsyncContext<A> for WebsocketContext<A, S> where A: Actor<Context=Sel
fn cancel_future(&mut self, handle: SpawnHandle) -> bool { fn cancel_future(&mut self, handle: SpawnHandle) -> bool {
self.inner.cancel_future(handle) self.inner.cancel_future(handle)
} }
}
#[doc(hidden)] #[doc(hidden)]
impl<A, S> AsyncContextApi<A> for WebsocketContext<A, S> where A: Actor<Context=Self> {
#[inline] #[inline]
fn unsync_address(&mut self) -> Address<A> { fn local_address(&mut self) -> Address<A> {
self.inner.unsync_address() self.inner.unsync_address()
} }
#[doc(hidden)]
#[inline] #[inline]
fn sync_address(&mut self) -> SyncAddress<A> { fn sync_address(&mut self) -> SyncAddress<A> {
self.inner.sync_address() self.inner.sync_address()
@ -235,7 +233,7 @@ impl<A, S> ToEnvelope<A> for WebsocketContext<A, S>
where A: Actor<Context=WebsocketContext<A, S>>, where A: Actor<Context=WebsocketContext<A, S>>,
{ {
#[inline] #[inline]
fn pack_msg<M>(msg: M, tx: Option<Sender<MessageResult<M>>>) -> Envelope<A> fn pack<M>(msg: M, tx: Option<Sender<MessageResult<M>>>) -> Envelope<A>
where A: Handler<M>, where A: Handler<M>,
M: ResponseType + Send + 'static, M::Item: Send, M::Error: Send { M: ResponseType + Send + 'static, M::Item: Send, M::Error: Send {
RemoteEnvelope::envelope(msg, tx).into() RemoteEnvelope::envelope(msg, tx).into()