Read user input from the terminal in Rust using std::io::stdin and the read_line method.
Use std::io::stdin() to get a handle to standard input, then call read_line on it to populate a mutable String.
use std::io;
fn main() {
let mut guess = String::new();
io::stdin()
.read_line(&mut guess)
.expect("Failed to read line");
println!("You guessed: {guess}");
}
Reading from standard input in Rust tells your program to pause and wait for the user to type something into their terminal. It captures whatever they type and stores it in a variable so your program can use it later. Think of it like a cashier waiting for you to hand over your order before they can process it.