quick_input 0.1.2

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

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).

This crate currently supports the current data types: 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);

  • 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.