#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ParseError {
Empty,
TooLong,
InvalidLetter,
InvalidStateModifier,
InvalidTerminalMarker,
}
impl core::fmt::Display for ParseError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let message = match self {
Self::Empty => "empty PIN token",
Self::TooLong => "PIN token longer than three characters",
Self::InvalidLetter => "PIN token must contain exactly one ASCII letter",
Self::InvalidStateModifier => "invalid PIN state modifier (expected '+' or '-')",
Self::InvalidTerminalMarker => "invalid PIN terminal marker (expected '^')",
};
f.write_str(message)
}
}
impl core::error::Error for ParseError {}