logo

Function async_std::io::stdin

source · []
pub fn stdin() -> Stdin
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?;