macro_rules! inputln {
() => { ... };
($($arg:tt)*) => { ... };
}Expand description
A macro that:
- prints the prompt on its own line (with
println!), - then reads one line,
- returns
Err(InputError::Eof)if EOF is encountered. - returns
Err(InputError::Parse(e))if the input cannot be parsed. - returns
Err(InputError::Io(e))if an IO error occurs. - otherwise parses into
String.
ยงUsage:
let line: String = inputln!("What's your favorite color?").unwrap();