questionThing 0.1.4

package to make input question stuff easier
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::io::{self, Write};

pub fn question(message: &str, continue_message: &str) -> String {
	loop {
		println!("{}", message);
		io::stdout().flush().unwrap();
		let mut input = String::new();
		io::stdin().read_line(&mut input).expect("failed to read line");
		let trimmed = input.trim();
        if !trimmed.is_empty() {
            return trimmed.to_string();
        } else {
            println!("{}", continue_message);
        }
    }
}