#input #quick #quick-input #option-and-str

quick_input

A lightweight library to easily handle user input wich supports custom messages

5 releases

Uses new Rust 2024

0.1.4 Mar 16, 2025
0.1.3 Mar 16, 2025
0.1.2 Mar 16, 2025
0.1.1 Mar 16, 2025
0.1.0 Mar 16, 2025

#464 in Command-line interface

Download history 328/week @ 2025-03-12 24/week @ 2025-03-19

352 downloads per month

Apache-2.0

40KB
400 lines

Quick Input


This lightweight crate offers a quick and easy way of handling user input, which can then be assigned to a variable directly. All functions handle the possibility of invalid values by looping until the desired type is inputted.

Both an initial prompt message and error message are customisable and optional. If the error message is left empty (None), a default error message will be displayed (relaying on the default message should be avoided when possible).

The data types currently supported by this crate are: i32, u32, String, char, boolean, f32, f64, i8, u8, i16, u16, i64, u64, i128, u128, isize and usize.

All functions in this crate follow the "read_*" naming convention; some examples are:

  • read_i32(msg: Option<&str>, err_msg: Option<&str>);

  • read_string(msg: Option<&str>);

  • read_i32_def_err(msg: Option<&str>);

  • read_string_no_msg();

Refer to this crate's documentation in case of doubt.

Author: Kevin Claramonte Soler - kevclasol@proton.me

No runtime deps