[−][src]Function lab_grader::helpers::cli::prompt
pub fn prompt(msg: &str) -> String
Prompts a user for input from the CLI.
Returns the string they entered, with leading and trailing whitespace trimmed. This method will loop infinitely until a valid string is read.
If you're going to cast the result to a certain type, try the
prompt!
macro.
Example
use lab_grader::helpers::cli::prompt; let input = prompt("Enter hello: "); println!("{}", input);
They see:
Enter hello: hello
hello