Compilation errors using simple example https://github.com/snapview/tungstenite-rs
What's the issue? It looks like a legitimate error to me.
use std::net::TcpListener;
use std::thread::spawn;
use tungstenite::server::accept;
/// A WebSocket echo server
fn main () {
let server = TcpListener::bind("127.0.0.1:9001").unwrap();
for stream in server.incoming() {
spawn (move || {
let mut websocket = accept(stream.unwrap()).unwrap();
loop {
let msg = websocket.read_message().unwrap();
// We do not want to send back ping/pong messages.
if msg.is_binary() || msg.is_text() {
websocket.write_message(msg).unwrap();
}
}
});
}
}
error[E0603]: module `server` is private
--> src/main.rs:3:18
|
3 | use tungstenite::server::accept;
| ^^^^^^ private module
|
note: the module `server` is defined here
--> /home/jpm/.cargo/registry/src/github.com-1ecc6299db9ec823/tungstenite-0.15.0/src/lib.rs:22:1
|
22 | mod server;
| ^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0603`.
error: could not compile `goo`
To learn more, run the command again with --verbose.
[dependencies]
tungstenite = "0.15.0"
$ rustc --version
rustc 1.51.0 (2fd73fabe 2021-03-23)