prompt_until_ok

Function prompt_until_ok 

Source
pub fn prompt_until_ok<T>(prompt: &(impl ToString + Display + ?Sized)) -> T
where T: FromStr + 'static,
Expand description

Creates a CLI prompt and repeatetly asks the user for input until their input is of valid type.

ยงExample

use read_stdin;

let n: i32 = read_stdin::prompt_until_ok("Enter a number: ");

println!("You entered: {}", n);