validators 0.26.0

This library is designed for validating and modeling user input. The crate includes models, functions, traits, errors, and other dependencies.
use core::fmt::{self, Display, Formatter};

/// Error from the `line` validator.
#[derive(Debug, Clone)]
pub enum LineError {
    Invalid,
    /// May not be valid, but it is guaranteed that this line is too long.
    TooLong,
    /// May not be valid, but it is guaranteed that this line is too short.
    TooShort,
}

impl Display for LineError {
    #[inline]
    fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
        match self {
            Self::Invalid => f.write_str("invalid line"),
            Self::TooLong => f.write_str("line is too long"),
            Self::TooShort => f.write_str("line is too short"),
        }
    }
}

impl core::error::Error for LineError {}