quick_input

Crates.ioquick_input
lib.rsquick_input
version0.2.0
created_at2025-03-16 14:10:42.554379+00
updated_at2025-05-14 13:10:05.071829+00
descriptionA lightweight library to easily handle user input wich supports custom messages.
homepage
repositoryhttps://github.com/KevinClaramonteSoler/quick_input
max_upload_size
id1594441
size42,327
Kevin Claramonte Soler (KevinClaramonteSoler)

documentation

README

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

Commit count: 4

cargo fmt