浏览代码

futures_tokio_compat is not needed anymore.

父节点
当前提交
65cff3fc69
共有 3 个文件被更改,包括 2 次插入4 次删除
  1. 0
    1
      Cargo.lock
  2. 0
    1
      Cargo.toml
  3. 2
    2
      src/bin/server.rs

+ 0
- 1
Cargo.lock 查看文件

936
  "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
936
  "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
937
  "fswatcher 0.1.0 (git+https://github.com/mgottschlag/fswatcher-rs.git)",
937
  "fswatcher 0.1.0 (git+https://github.com/mgottschlag/fswatcher-rs.git)",
938
  "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
938
  "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
939
- "futures-tokio-compat 0.1.0 (git+https://github.com/mgottschlag/futures-tokio-compat.git)",
940
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
939
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
941
  "rmp-serde 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
940
  "rmp-serde 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
942
  "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
941
  "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",

+ 0
- 1
Cargo.toml 查看文件

12
 byteorder = "1.3"
12
 byteorder = "1.3"
13
 tokio = { version = "0.2", features = ["fs", "io-util", "macros", "net", "rt-threaded", "stream", "sync", "tcp", "time"] }
13
 tokio = { version = "0.2", features = ["fs", "io-util", "macros", "net", "rt-threaded", "stream", "sync", "tcp", "time"] }
14
 futures = "0.3.1"
14
 futures = "0.3.1"
15
-futures-tokio-compat = { git = "https://github.com/mgottschlag/futures-tokio-compat.git" }
16
 async-tungstenite = { version = "0.3", features = ["tokio-runtime"] }
15
 async-tungstenite = { version = "0.3", features = ["tokio-runtime"] }
17
 env_logger = "0.7"
16
 env_logger = "0.7"
18
 log = "0.4"
17
 log = "0.4"

+ 2
- 2
src/bin/server.rs 查看文件

3
 use std::sync::{Arc, Mutex};
3
 use std::sync::{Arc, Mutex};
4
 
4
 
5
 use async_tungstenite::accept_async;
5
 use async_tungstenite::accept_async;
6
+use async_tungstenite::tokio::TokioAdapter;
6
 use futures::sink::SinkExt;
7
 use futures::sink::SinkExt;
7
-use futures_tokio_compat::Compat;
8
 use log::*;
8
 use log::*;
9
 use tokio::net::{TcpListener, TcpStream};
9
 use tokio::net::{TcpListener, TcpStream};
10
 use tokio::stream::StreamExt;
10
 use tokio::stream::StreamExt;
65
 // TODO: Robust error handling.
65
 // TODO: Robust error handling.
66
 
66
 
67
 async fn accept_connection(peer: SocketAddr, stream: TcpStream) {
67
 async fn accept_connection(peer: SocketAddr, stream: TcpStream) {
68
-    let mut ws_stream = accept_async(Compat::new(stream))
68
+    let mut ws_stream = accept_async(TokioAdapter(stream))
69
         .await
69
         .await
70
         .expect("Failed to accept");
70
         .expect("Failed to accept");
71
 
71
 

正在加载...
取消
保存