use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum FormatError {
InsufficientParameters,
InvalidFormatString,
UnsupportedFormatType,
ExpectedUsize,
}
impl fmt::Display for FormatError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
FormatError::InsufficientParameters => write!(f, "Insufficient parameters"),
FormatError::InvalidFormatString => write!(f, "Invalid format string"),
FormatError::UnsupportedFormatType => {
write!(f, "Argument does not support the requested format type")
}
FormatError::ExpectedUsize => {
write!(f, "Width/precision argument must be an unsigned integer")
}
}
}
}
impl std::error::Error for FormatError {}