pub fn input<T>() -> Result<T, InputError<T>>where
T: FromStr,
Expand description
This function is able to take in an input with a type constraint.
§Example
use constrained_inputs::input;
fn main() {
let int = input::<i32>().expect("Input was invalid");
println!("Your input integer: {}", int);
}
§Errors
This function returns an InputError
if the input is invalid, if a parsing error occurs,
or if the input does not meet the specified constraints.