validators 0.25.3

This library is designed for validating and modeling user input. The crate includes models, functions, traits, errors, and other dependencies.
Documentation
use core::fmt::{self, Display, Formatter};
#[cfg(feature = "std")]
use std::error::Error;

/// Error from the `length` validator.
#[derive(Debug, Clone)]
pub enum LengthError {
    TooLarge,
    TooSmall,
}

impl Display for LengthError {
    #[inline]
    fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
        match self {
            Self::TooLarge => f.write_str("collection is too large"),
            Self::TooSmall => f.write_str("collection is too small"),
        }
    }
}

#[cfg(feature = "std")]
impl Error for LengthError {}