Skip to content

Commit

Permalink
wip Debug for FromHexError
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdplm committed Aug 10, 2018
1 parent d7a2abd commit f9c7989
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ impl fmt::Debug for FromHexError {
}
}

#[cfg(not(feature = "std"))]
impl fmt::Debug for FromHexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
InvalidHexCharacter(ch, idx) =>
write!(f, "Invalid character '{}' at position {}", ch, idx),
InvalidHexLength => write!(f, "Invalid input length"),
}
}
}

#[cfg(feature = "std")]
impl ::std::error::Error for FromHexError {
fn description(&self) -> &str {
Expand Down

0 comments on commit f9c7989

Please sign in to comment.