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 - Number constraint config for applying constraints onto some number
- String
Constraint - String constraint config for applying constraints to what a string can be
Enums§
- Constraint
Error - Error types for constraints
- Constraint
Result - Result type for constraints
- Input
Error - Error gotten either when input is invalid or some I/O error occurs
Traits§
- Constraint
- Constraint trait
Functions§
- constrained_
input - Prompts user input in the terminal with an added type constraint.
- input
- This function is able to take in an input with a type constraint.
- input_
stream - Reads an input from a
BufRead
reader.