Constrained Inputs
Constrained Inputs is a Rust crate that simplifies the process of handling user input with specific type constraints and validations. This crate provides a mechanism to define and apply constraints to ensure that user inputs meet certain criteria before being accepted.
Features
- Easy-to-use input parsing and prompting
- Customizable constraints for strings and numbers
- Detailed error handling for invalid inputs and constraint violations
Usage
Basic Input Parsing
You can use the input function to parse user input directly into a specified type.
use input;
Constrained Input Parsing
Use the constrained_input function to prompt user input with additional constraints.
use ;
Constraints
The constraints module provides various constraint configurations that can be applied to user inputs. These include constraints for strings and numbers.
String Constraints
Define constraints on strings, such as maximum length, minimum length, and blacklisted characters.
use ;
Number Constraints
Define constraints on numbers, such as maximum and minimum values.
use ;
Input Stream
A function that reads in a stream of data from a bufreader.