From f2cabc37eff3d85a42058180319926376604b7f6 Mon Sep 17 00:00:00 2001 From: Ximon Eighteen <3304436+ximon18@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:35:09 +0100 Subject: [PATCH] Impl Display for Nsec3HashError. --- src/validate.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/validate.rs b/src/validate.rs index 3293df0f..37d44836 100644 --- a/src/validate.rs +++ b/src/validate.rs @@ -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].