aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2022-07-17 14:23:14 +0100
committerdiogo464 <[email protected]>2022-07-17 14:23:14 +0100
commit9cc48f40fbb1a0149b9e3bf9d5d7a518fecc851f (patch)
tree1b18c07851a09012c8262284f2fcdc63c0f9bc4e /src/lib.rs
parentf6589903cddae50078f4a8f7c8f5de91bd75403d (diff)
impl std::error::Error for HexDecodeError
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index ae346a1..36790b7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,6 +13,17 @@ pub enum HexDecodeError {
13 InvalidHexCharacter, 13 InvalidHexCharacter,
14} 14}
15 15
16impl 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
25impl std::error::Error for HexDecodeError {}
26
16struct EncodeHexIterSlice<'data_lifetime> { 27struct 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],