binance / binance-spot-connector-rust

MIT License
124 stars 43 forks source link

Fix build of feature "enable-tokio-tungstenite" #8

Closed ZhouYuChen closed 3 months ago

ZhouYuChen commented 10 months ago

This PR fix the build error when it compiles only with feature enable-tokio-tungstenite. Feature enable-tokio-tungstenite requires tokio and futures_util.

Test command

cargo build --features enable-tokio-tungstenite

It fails to build without this commit:

error[E0433]: failed to resolve: use of undeclared crate or module `tokio`
 --> src/tokio_tungstenite.rs:3:5
  |
3 | use tokio::io::{AsyncRead, AsyncWrite};
  |     ^^^^^ use of undeclared crate or module `tokio`

error[E0433]: failed to resolve: use of undeclared crate or module `tokio`
 --> src/tokio_tungstenite.rs:4:5
  |
4 | use tokio::net::TcpStream;
  |     ^^^^^ use of undeclared crate or module `tokio`

error[E0432]: unresolved import `futures_util`
 --> src/tokio_tungstenite.rs:2:5
  |
2 | use futures_util::SinkExt;
  |     ^^^^^^^^^^^^ use of undeclared crate or module `futures_util`