bin_encode_decode/common/error/
impl.rs

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