# tokio::io::stdin - Rust
API documentation for the Rust `stdin` fn in crate `tokio`.
Keywords: rust, rustlang, rust-lang, stdin

# Function tokio::io::stdin [−] [src]

    pub fn stdin() -> Stdin

Constructs a new handle to the standard input of the current process.

This handle is best used for non-interactive uses, such as when a file is piped into the application. For technical reasons, `stdin` is implemented by using an ordinary blocking read on a separate thread, and it is impossible to cancel that read. This can make shutdown of the runtime hang until the user presses enter.

For interactive uses, it is recommended to spawn a thread dedicated to user input and use blocking IO directly in that thread.