1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 18:37:41 +02:00

use new actix api

This commit is contained in:
Nikolay Kim
2018-02-12 16:08:04 -08:00
parent 720d8c36c1
commit 335ca8ff33
9 changed files with 29 additions and 28 deletions

View File

@ -103,7 +103,7 @@ pub struct WsClient {
http_err: Option<HttpError>,
origin: Option<HeaderValue>,
protocols: Option<String>,
conn: Addr<Unsync<ClientConnector>>,
conn: Addr<Unsync, ClientConnector>,
}
impl WsClient {
@ -114,7 +114,7 @@ impl WsClient {
}
/// Create new websocket connection with custom `ClientConnector`
pub fn with_connector<S: AsRef<str>>(uri: S, conn: Addr<Unsync<ClientConnector>>) -> WsClient {
pub fn with_connector<S: AsRef<str>>(uri: S, conn: Addr<Unsync, ClientConnector>) -> WsClient {
let mut cl = WsClient {
request: ClientRequest::build(),
err: None,
@ -200,7 +200,7 @@ impl WsClient {
// get connection and start handshake
Ok(Box::new(
self.conn.call_fut(Connect(request.uri().clone()))
self.conn.call(Connect(request.uri().clone()))
.map_err(|_| WsClientError::Disconnected)
.and_then(|res| match res {
Ok(stream) => Either::A(WsHandshake::new(stream, request)),

View File

@ -67,13 +67,13 @@ impl<A, S> AsyncContext<A> for WebsocketContext<A, S> where A: Actor<Context=Sel
#[doc(hidden)]
#[inline]
fn unsync_address(&mut self) -> Addr<Unsync<A>> {
fn unsync_address(&mut self) -> Addr<Unsync, A> {
self.inner.unsync_address()
}
#[doc(hidden)]
#[inline]
fn sync_address(&mut self) -> Addr<Syn<A>> {
fn sync_address(&mut self) -> Addr<Syn, A> {
self.inner.sync_address()
}
}
@ -217,12 +217,12 @@ impl<A, S> ActorHttpContext for WebsocketContext<A, S> where A: Actor<Context=Se
}
}
impl<A, M, S> ToEnvelope<Syn<A>, M> for 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: Message + Send + 'static, M::Result: Send
{
fn pack(msg: M, tx: Option<Sender<M::Result>>) -> Syn<A> {
Syn::new(Box::new(SyncEnvelope::envelope(msg, tx)))
fn pack(msg: M, tx: Option<Sender<M::Result>>) -> SyncEnvelope<A> {
SyncEnvelope::new(msg, tx)
}
}