diff options
| author | diogo464 <[email protected]> | 2022-07-17 14:23:14 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2022-07-17 14:23:14 +0100 |
| commit | 9cc48f40fbb1a0149b9e3bf9d5d7a518fecc851f (patch) | |
| tree | 1b18c07851a09012c8262284f2fcdc63c0f9bc4e | |
| parent | f6589903cddae50078f4a8f7c8f5de91bd75403d (diff) | |
impl std::error::Error for HexDecodeError
| -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], |
