Use the dialoguer crate to prompt the user for input and handle the result with a Result type.
[dependencies]
dialoguer = "0.11"
use dialoguer::Input;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let name: String = Input::new()
.with_prompt("Enter your name")
.interact_text()?;
println!("Hello, {}!", name);
Ok(())
}