【发布时间】:2018-09-11 10:15:03
【问题描述】:
我的部分代码如下所示:
print_usage_instructions();
print!("Command: ");
let stdin = io::stdin();
let mut line = String::new();
stdin.lock().read_line(&mut line).expect("Couldn't process the command.");
println!("{}", line);
我在这里期望的行为是这样的:
Usage instructions and stuff
Command: [my command]
[my command]
然而,发生的事情是这样的:
Usage instructions and stuff
[my command]
Command: [my command]
任何想法为什么会发生? AFAIK,编译器没有理由在这里更改执行顺序,这部分代码既不是异步也不是多线程。
【问题讨论】:
标签: rust rust-macros