|
1 | 1 | use crate::*; |
2 | 2 |
|
| 3 | +//github.com/ Provides display formatting for EncodeError. |
| 4 | +//github.com/ |
| 5 | +//github.com/ Implements human-readable error messages for encoding failures. |
| 6 | +impl fmt::Display for EncodeError { |
| 7 | + //github.com/ Formats the EncodeError for display purposes. |
| 8 | + //github.com/ |
| 9 | + //github.com/ # Arguments |
| 10 | + //github.com/ |
| 11 | + //github.com/ - `&mut fmt::Formatter<'_>` - The formatter to use. |
| 12 | + //github.com/ |
| 13 | + //github.com/ # Returns |
| 14 | + //github.com/ |
| 15 | + //github.com/ - `fmt::Result` - Result of the formatting operation. |
| 16 | + #[inline(always)] |
| 17 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 18 | + match self { |
| 19 | + EncodeError::CharsetError => write!( |
| 20 | + f, |
| 21 | + "EncodeError: Charset is invalid. Please ensure the charset contains exactly {CHARSET_LEN} unique characters." |
| 22 | + ), |
| 23 | + } |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +//github.com/ Provides display formatting for DecodeError. |
| 28 | +//github.com/ |
| 29 | +//github.com/ Implements human-readable error messages for decoding failures. |
| 30 | +impl fmt::Display for DecodeError { |
| 31 | + //github.com/ Formats the DecodeError for display purposes. |
| 32 | + //github.com/ |
| 33 | + //github.com/ # Arguments |
| 34 | + //github.com/ |
| 35 | + //github.com/ - `&mut fmt::Formatter<'_>` - The formatter to use. |
| 36 | + //github.com/ |
| 37 | + //github.com/ # Returns |
| 38 | + //github.com/ |
| 39 | + //github.com/ - `fmt::Result` - Result of the formatting operation. |
| 40 | + #[inline(always)] |
| 41 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 42 | + match self { |
| 43 | + DecodeError::CharsetError => write!( |
| 44 | + f, |
| 45 | + "DecodeError: Charset is invalid. Please ensure the charset contains exactly {CHARSET_LEN} unique characters." |
| 46 | + ), |
| 47 | + } |
| 48 | + } |
| 49 | +} |
| 50 | + |
3 | 51 | //github.com/ Provides default implementation for Charset. |
4 | 52 | //github.com/ |
5 | 53 | //github.com/ Creates a new Charset instance with empty string as default charset. |
|
0 commit comments