【发布时间】:2015-02-15 17:38:24
【问题描述】:
在std::io documentation 中接收字符串作为变量并没有直接的说明,但我认为这应该可行:
use std::io;
let line = io::stdin().lock().lines().unwrap();
但是我收到了这个错误:
src\main.rs:28:14: 28:23 error: unresolved name `io::stdin`
src\main.rs:28 let line = io::stdin.lock().lines().unwrap();
^~~~~~~~~
为什么?
我正在使用夜间 Rust v1.0。
【问题讨论】:
-
@Shepmaster 是的,但我认为'old_io' 意味着它是一个已弃用的功能。是不是反过来?
-
您所指的文档是针对第一个 alpha 版本的。然后名为
io的模块在 发布后重命名为old_io,它确实即将淘汰,但尚未完全被新的io模块取代。首先你需要弄清楚你的立场:你是在使用 1.0.0-alpha 还是在跟踪夜间?