1use core::fmt;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5#[non_exhaustive]
6pub enum FormatError {
7 InsufficientParameters,
9 InvalidFormatString,
12 UnsupportedFormatType,
15 ExpectedUsize,
18 WriteFailed,
21}
22
23impl fmt::Display for FormatError {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 match self {
26 FormatError::InsufficientParameters => write!(f, "Insufficient parameters"),
27 FormatError::InvalidFormatString => write!(f, "Invalid format string"),
28 FormatError::UnsupportedFormatType => {
29 write!(f, "Argument does not support the requested format type")
30 }
31 FormatError::ExpectedUsize => {
32 write!(f, "Width/precision argument must be an unsigned integer")
33 }
34 FormatError::WriteFailed => write!(f, "Failed to write to the output sink"),
35 }
36 }
37}
38
39impl core::error::Error for FormatError {}