macro_rules! input {
() => { ... };
($($arg:tt)*) => { ... };
}
Expand description
Displays formatted prompt text to the standard output and
then reads the next line from the standard input,
returning it as a String
.
§Panics
Panics if writing to std::io::stdout()
fails,
or reading from std::io::stdin()
fails.
§Example
use input_macro::input;
let name: String = input!("What's your name? ");
let age: i64 = input!("How old are you today {name}? ").parse().unwrap();
println!(
"In hexadecimal, thats {}{:x}!",
if age < 0 { "-" } else { "" }, age.abs(),
);