pub fn input<S: ToString>(prompt: S) -> String {
    let mut buf = String::new();
    print!("{}", prompt.to_string());
    let _ = stdout().flush();

    stdin().read_line(&mut buf).expect("Could not get user input");

    while let Some('\n') = buf.chars().next_back() {
        buf.pop();
    }

    while let Some('\r') = buf.chars().next_back() {
        buf.pop();
    }

    return buf;
}
/// This function prompts the user with a message and returns the user's input.
/// It also pops off trailing carriage returns.
This function prompts the user with a message and returns the user's input.
It also pops off trailing carriage returns.
This function prompts the user with a message and returns the user ' s input . It also pops off trailing carriage returns .
pub fn input<S: ToString>(prompt: S) -> String {
    let mut buf = String::new();
    print!("{}", prompt.to_string());
    let _ = stdout().flush();
    stdin().read_line(&mut buf).expect("Could not get user input");
    while let Some('\n') = buf.chars().next_back() {
        buf.pop();
    }
    while let Some('\r') = buf.chars().next_back() {
        buf.pop();
    }
    return buf;
}
pub fn input < S : ToString > ( prompt : S ) -> String { let mut buf = String :: new ( ) ; print ! ( " " prompt to_string ( ) ) ; let _ = stdout ( ) . flush ( ) ; stdin ( ) . read_line ( & mut buf ) . expect ( " " ) ; while let Some ( '\n' ) = buf . chars ( ) . next_back ( ) { buf . pop ( ) ; } while let Some ( '\r' ) = buf . chars ( ) . next_back ( ) { buf . pop ( ) ; } return buf ; }
This function prompts the user with a message and returns the user's input.
This function prompts the user with a message and returns the user ' s input .
prompt
S
prompt
S