From eb041de36d99935903cf8cc70790a352a9876bd2 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 12 Feb 2018 19:15:39 -0800 Subject: [PATCH] update examples --- .travis.yml | 1 + examples/diesel/src/main.rs | 4 ++-- examples/state/src/main.rs | 2 +- examples/websocket/src/client.rs | 2 +- src/server/srv.rs | 8 ++++---- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b4c8fd7b..e7ed24526 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,7 @@ script: cd examples/hello-world && cargo check && cd ../.. cd examples/multipart && cargo check && cd ../.. cd examples/json && cargo check && cd ../.. + cd examples/state && cargo check && cd ../.. cd examples/template_tera && cargo check && cd ../.. cd examples/diesel && cargo check && cd ../.. cd examples/tls && cargo check && cd ../.. diff --git a/examples/diesel/src/main.rs b/examples/diesel/src/main.rs index 881cbe1c5..4f61fa0b4 100644 --- a/examples/diesel/src/main.rs +++ b/examples/diesel/src/main.rs @@ -31,14 +31,14 @@ use db::{CreateUser, DbExecutor}; /// State with DbExecutor address struct State { - db: Addr>, + db: Addr, } /// Async request handler fn index(req: HttpRequest) -> Box> { let name = &req.match_info()["name"]; - req.state().db.call_fut(CreateUser{name: name.to_owned()}) + req.state().db.call(CreateUser{name: name.to_owned()}) .from_err() .and_then(|res| { match res { diff --git a/examples/state/src/main.rs b/examples/state/src/main.rs index 5bb7e5043..21eb50483 100644 --- a/examples/state/src/main.rs +++ b/examples/state/src/main.rs @@ -44,7 +44,7 @@ impl Handler for MyWebSocket { println!("WS({}): {:?}", self.counter, msg); match msg { ws::Message::Ping(msg) => ctx.pong(&msg), - ws::Message::Text(text) => ctx.text(&text), + ws::Message::Text(text) => ctx.text(text), ws::Message::Binary(bin) => ctx.binary(bin), ws::Message::Closed | ws::Message::Error => { ctx.stop(); diff --git a/examples/websocket/src/client.rs b/examples/websocket/src/client.rs index 3eba7277e..38a7bd5eb 100644 --- a/examples/websocket/src/client.rs +++ b/examples/websocket/src/client.rs @@ -28,7 +28,7 @@ fn main() { () }) .map(|(reader, writer)| { - let addr: Addr> = ChatClient::create(|ctx| { + let addr: Addr = ChatClient::create(|ctx| { ChatClient::add_stream(reader, ctx); ChatClient(writer) }); diff --git a/src/server/srv.rs b/src/server/srv.rs index a41e17c7f..69b46bc7f 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -333,7 +333,7 @@ impl HttpServer impl HttpServer { /// Start listening for incoming tls connections. - pub fn start_tls(mut self, acceptor: TlsAcceptor) -> io::Result> { + pub fn start_tls(mut self, acceptor: TlsAcceptor) -> io::Result> { if self.sockets.is_empty() { Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound")) } else { @@ -350,7 +350,7 @@ impl HttpServer // start http server actor let signals = self.subscribe_to_signals(); - let addr: SyncAddress<_> = Actor::start(self); + let addr: Addr = Actor::start(self); signals.map(|signals| signals.send( signal::Subscribe(addr.clone().subscriber()))); Ok(addr) @@ -364,7 +364,7 @@ impl HttpServer /// Start listening for incoming tls connections. /// /// This method sets alpn protocols to "h2" and "http/1.1" - pub fn start_ssl(mut self, mut builder: SslAcceptorBuilder) -> io::Result> + pub fn start_ssl(mut self, mut builder: SslAcceptorBuilder) -> io::Result> { if self.sockets.is_empty() { Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound")) @@ -394,7 +394,7 @@ impl HttpServer // start http server actor let signals = self.subscribe_to_signals(); - let addr: SyncAddress<_> = Actor::start(self); + let addr: Addr = Actor::start(self); signals.map(|signals| signals.send( signal::Subscribe(addr.clone().subscriber()))); Ok(addr)