1use std::fmt::{Display, Formatter};
2
3#[derive(Debug)]
4pub enum DecodeError {
5 InvalidCharacter(char),
6 InvalidLength,
7 NoSeparator,
8}
9
10impl Display for DecodeError {
11 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
12 match self {
13 DecodeError::InvalidCharacter(c) => write!(f, "Invalid character: {}", c),
14 DecodeError::InvalidLength => write!(f, "Invalid length"),
15 DecodeError::NoSeparator => write!(f, "No separator"),
16 }
17 }
18}
19
20impl std::error::Error for DecodeError {}