Skip to content

Commit

Permalink
Impl Display for Nsec3HashError.
Browse files Browse the repository at this point in the history
  • Loading branch information
ximon18 committed Nov 6, 2024
1 parent bdeddde commit f2cabc3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,19 @@ pub enum Nsec3HashError {
CollisionDetected,
}

///--- Display

impl std::fmt::Display for Nsec3HashError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Nsec3HashError::UnsupportedAlgorithm => f.write_str("Unsupported algorithm"),
Nsec3HashError::AppendError => f.write_str("Append error: out of memory?"),
Nsec3HashError::OwnerHashError => f.write_str("Hashing produced an invalid owner hash"),
Nsec3HashError::CollisionDetected => f.write_str("Hash collision detected"),
}
}
}

/// Compute an [RFC 5155] NSEC3 hash using default settings.
///
/// See: [Nsec3param::default].
Expand Down

0 comments on commit f2cabc3

Please sign in to comment.