macro_rules! input_no_eof {
() => { ... };
($($arg:tt)*) => { ... };
}
Expand description
A macro that:
- reads one line from stdin,
- tries to parse into
String
, - treats EOF as an error (no
Ok(None)
).
ยงUsage:
// No prompt
let line: String = input_no_eof!().unwrap();
// With prompt
let age: i32 = input_no_eof!("Enter your age: ").unwrap();