diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
| @@ -13,6 +13,17 @@ pub enum HexDecodeError { | |||
| 13 | InvalidHexCharacter, | 13 | InvalidHexCharacter, |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | impl std::fmt::Display for HexDecodeError { | ||
| 17 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
| 18 | match self { | ||
| 19 | HexDecodeError::InvalidByteCount => write!(f, "Invalid byte count"), | ||
| 20 | HexDecodeError::InvalidHexCharacter => write!(f, "Invalid hex character"), | ||
| 21 | } | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | impl std::error::Error for HexDecodeError {} | ||
| 26 | |||
| 16 | struct EncodeHexIterSlice<'data_lifetime> { | 27 | struct EncodeHexIterSlice<'data_lifetime> { |
| 17 | //bytes to encode as hex | 28 | //bytes to encode as hex |
| 18 | data: &'data_lifetime [u8], | 29 | data: &'data_lifetime [u8], |
