Skip to content

Instantly share code, notes, and snippets.

@ElectricCoffee
Last active September 28, 2018 18:29
Show Gist options
  • Save ElectricCoffee/46f52d8ca28b69c6fb0889b0730d4332 to your computer and use it in GitHub Desktop.
Save ElectricCoffee/46f52d8ca28b69c6fb0889b0730d4332 to your computer and use it in GitHub Desktop.
provides a simple python-esque prompt
use std::io::{self, Write};
fn prompt(input: &str) -> io::Result<String> {
let mut output = String::new();
print!("{}", input);
io::stdout().flush()?;
io::stdin().read_line(&mut output)?;
Ok(output)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment