Part of the 1.18 release notes said:
For our Windows users, Rust 1.18.0 has a new attribute,
#![windows_subsystem]
.
When is this useful? In the simplest terms, if you’re developing a graphical application, and do not specify windows, a console window would flash up upon your application’s start. With this flag, it won’t.
If I compile this simple example and double click on the .exe
file in Windows Explorer:
#![windows_subsystem(windows)]
use std::{thread, time};
fn main() {
let ten_millis = time::Duration::from_secs(3);
thread::sleep(ten_millis);
}
A console window pops up for 3 seconds and then goes away. I thought that the attribute made it so the console window wasn't suppose to appear? What am I missing?
Config
- Windows 10 x64
> rustup show
...
active toolchain
----------------
stable-x86_64-pc-windows-msvc (default)
rustc 1.18.0 (03fc9d622 2017-06-06)