Macro inputln

Source
macro_rules! inputln {
    () => { ... };
    ($($arg:tt)*) => { ... };
}
Expand description

A macro that:

  • prints the prompt on its own line (with println!),
  • then reads one line,
  • returns Ok(None) on EOF,
  • otherwise parses into String.

ยงUsage:

let line: Option<String> = inputln!("What's your favorite color?").unwrap();