1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-01 01:16:59 +02:00

update actix api

This commit is contained in:
Nikolay Kim
2018-02-12 01:13:06 -08:00
parent 285c66e7d8
commit 30bdf9cb5e
6 changed files with 33 additions and 38 deletions

View File

@@ -5,9 +5,9 @@ use futures::unsync::oneshot;
use smallvec::SmallVec;
use actix::{Actor, ActorState, ActorContext, AsyncContext,
Address, SyncAddress, Handler, ResponseType, SpawnHandle, MessageResult};
Addr, Handler, ResponseType, SpawnHandle, MessageResult, Syn, Unsync};
use actix::fut::ActorFuture;
use actix::dev::{ContextImpl, Envelope, ToEnvelope, RemoteEnvelope};
use actix::dev::{ContextImpl, ToEnvelope, RemoteEnvelope};
use body::{Body, Binary};
use error::{Error, ErrorInternalServerError};
@@ -67,13 +67,13 @@ impl<A, S> AsyncContext<A> for WebsocketContext<A, S> where A: Actor<Context=Sel
#[doc(hidden)]
#[inline]
fn local_address(&mut self) -> Address<A> {
fn unsync_address(&mut self) -> Addr<Unsync<A>> {
self.inner.unsync_address()
}
#[doc(hidden)]
#[inline]
fn sync_address(&mut self) -> SyncAddress<A> {
fn sync_address(&mut self) -> Addr<Syn<A>> {
self.inner.sync_address()
}
}
@@ -217,14 +217,12 @@ impl<A, S> ActorHttpContext for WebsocketContext<A, S> where A: Actor<Context=Se
}
}
impl<A, S> ToEnvelope<A> for WebsocketContext<A, S>
where A: Actor<Context=WebsocketContext<A, S>>,
impl<A, M, S> ToEnvelope<Syn<A>, M> for WebsocketContext<A, S>
where A: Actor<Context=WebsocketContext<A, S>> + Handler<M>,
M: ResponseType + Send + 'static, M::Item: Send, M::Error: Send,
{
#[inline]
fn pack<M>(msg: M, tx: Option<Sender<MessageResult<M>>>) -> Envelope<A>
where A: Handler<M>,
M: ResponseType + Send + 'static, M::Item: Send, M::Error: Send {
RemoteEnvelope::envelope(msg, tx).into()
fn pack(msg: M, tx: Option<Sender<MessageResult<M>>>) -> Syn<A> {
Syn::new(Box::new(RemoteEnvelope::envelope(msg, tx)))
}
}