until_ok

Function until_ok 

Source
pub fn until_ok<T>() -> T
where T: FromStr + 'static,
Expand description

Read user input from stdin and try to parse it into a generic type. I will keep prompting the user for input until they enter data that properly parses.

ยงExample

use read_stdin;

let n: i32 = read_stdin::until_ok();

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