Last active
September 28, 2018 18:29
-
-
Save ElectricCoffee/46f52d8ca28b69c6fb0889b0730d4332 to your computer and use it in GitHub Desktop.
provides a simple python-esque prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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