once

Function once 

Source
pub fn once<T>() -> Result<T, <T as FromStr>::Err>
where T: FromStr + 'static,
Expand description

Read user input from stdin and try to parse it into a generic type.

ยงExample

use read_stdin;

let Ok(n) = read_stdin::once::<i32>() else {
    println!("You entered an incorrect data type!");
    return;
};

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