bin_encode_decode/common/
error.rs

1use crate::*;
2
3#[derive(Debug, Clone)]
4pub enum EncodeError {
5    CharsetError,
6}
7
8impl fmt::Display for EncodeError {
9    #[inline]
10    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11        match self {
12            EncodeError::CharsetError => write!(f, "EncodeError: Charset is invalid. Please ensure the charset contains exactly {} unique characters.",CHARSET_LEN ),
13        }
14    }
15}
16
17#[derive(Debug, Clone)]
18pub enum DecodeError {
19    CharsetError,
20}
21
22impl fmt::Display for DecodeError {
23    #[inline]
24    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25        match self {
26            DecodeError::CharsetError => write!(f, "DecodeError: Charset is invalid. Please ensure the charset contains exactly {} unique characters.", CHARSET_LEN),
27        }
28    }
29}