Skip to main content

stdin

Function stdin 

Source
pub fn stdin() -> Stdin
Available on crate feature std and crate feature default and non-target_os=unknown only.
Expand description

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

This function is an async version of std::io::stdin.

§Note: Windows Portability Consideration

When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to read bytes that are not valid UTF-8 will return an error.

§Examples

use async_std::io;

let stdin = io::stdin();
let mut line = String::new();
stdin.read_line(&mut line).await?;