Crate constrained_inputs
source ·Expand description
Crate for easy input parsing and prompting.
This crate allows for easy input constraints, making it simpler to handle user input with specific type constraints and validations.
§Example
use constrained_inputs::input;
fn main() {
let int = input::<i32>().expect("Input was invalid");
println!("Your input integer: {}", int);
}
Structs§
- Number constraint config for applying constraints onto some number
- String constraint config for applying constraints to what a string can be
Enums§
- Error types for constraints
- Result type for constraints
- Error gotten either when input is invalid or some I/O error occurs
Traits§
- Constraint trait
Functions§
- Prompts user input in the terminal with an added type constraint.
- This function is able to take in an input with a type constraint.
- Reads an input from a
BufRead
reader.