Rust 无法使用MIO编译项目-使用不稳定的库功能“udp_extras”
我试图从一篇文章中复制TCP客户端/服务器聊天。我无法为使用mio板条箱的服务器编译框架。这是我的密码:Rust 无法使用MIO编译项目-使用不稳定的库功能“udp_extras”,rust,Rust,我试图从一篇文章中复制TCP客户端/服务器聊天。我无法为使用mio板条箱的服务器编译框架。这是我的密码: extern crate mio; use mio::*; struct WebSocketServer; impl Handler for WebSocketServer { type Timeout = usize; type Message = (); } fn main() { let mut event_loop = EventLoop::new().
extern crate mio;
use mio::*;
struct WebSocketServer;
impl Handler for WebSocketServer {
type Timeout = usize;
type Message = ();
}
fn main() {
let mut event_loop = EventLoop::new().unwrap();
let mut handler = WebSocketServer;
event_loop.run(&mut handler).unwrap();
}
这是一条我完全不清楚的错误信息:
C:\Users\ZZZ\.cargo\git\checkouts\mio-75006fe295376f74\master\src\sys\windows\udp.rs:177:44: 177:61 error: use of unstab
le library feature 'udp_extras': available through the `net2` crate on crates.io
C:\Users\ZZZ\.cargo\git\checkouts\mio-75006fe295376f74\master\src\sys\windows\udp.rs:177 try!(self.inner().socke
t.socket()).set_broadcast(on)
^~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `mio`.
这是Cargo.toml:
我试图明确地将net2添加到节依赖项中,但仍然不起作用。看起来Windows对mio或rust的支持仍然不是很好。因此,这段代码不是用RustC1.3-stable编译的,而是用RustS1.5-nightly成功编译的
[package]
name = "rust-chat"
version = "0.2.0"
authors = ["Alex <zzz@yyy.com>"]
[dependencies.mio]
git = "https://github.com/carllerche/mio"