![crates.io version] ![Crates.io Downloads] ![crates.io license] ![Discord image]
Note: Thanks to @Restioson and @ThatsNoMoon for helping me write the code
Now Rust inputs are almost as simple as Python
Terminal inputs are now easier than ever. Replacing over 5 lines of codes with just 1 function.
Supports all formats that FromStr Supports
Instead of
rust
let mut var: String = String::new();
io::stdin().read_line(&mut var).unwrap();
let var: i32 = var.trim().parse().unwrap();
why not
rust
let var: i32 = input(Def);
and it doesn't panic when wrong format is entered (when default arg [Def]).
Or you can choose to make it panic too.
toml
[dependencies]
inputparser = "0.1"
```rust extern crate inputparser; use crate::inputparser::{input,ErHandle::*,inputwmsg};
fn main() { //for Default continue message "Input not supported" when Err let i: i32 = input(Def);
//for custom panic message when Err
let j: f64 = input(Pnc("Panic Message"));
//for custom continue message when Err
let k: u128 = input(Msg("Continue Message"));
//for custom loop message and continue/error message
let l: isize = input_w_msg("Enter the number",Msg("Please enter valid number"));
println!("{} {} {} {}", i, j, k,l);
} ```