1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::io::stdin;
/// Reads a line of user input from stdin into a String and returns it. Panics on fail.
pub fn read_line() -> String
{
    let mut input = String::new();
    stdin().read_line(&mut input).expect("Error: unable to read user input");
    
    input
}

/// Prompts the user with the provided &str msg before calling read_line() to get a user input string
pub fn read_line_prompt(msg: &str) -> String
{
    println!("{}", msg);
    read_line()
}