From 24bcfd779634843e5f12bcfbb1591fa783fdc890 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Wed, 10 Dec 2025 10:25:14 -0700 Subject: [PATCH] mcf: impl `Display` for `PasswordHashRef` It's a `str` newtype, so make it possible to display the underlying string --- mcf/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mcf/src/lib.rs b/mcf/src/lib.rs index 1260342f6..5babd886f 100644 --- a/mcf/src/lib.rs +++ b/mcf/src/lib.rs @@ -20,6 +20,7 @@ mod base64; mod error; mod fields; +use core::fmt; pub use error::{Error, Result}; pub use fields::{Field, Fields}; @@ -71,6 +72,12 @@ impl<'a> PasswordHashRef<'a> { } } +impl fmt::Display for PasswordHashRef<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.as_str()) + } +} + impl<'a> From> for &'a str { fn from(hash: PasswordHashRef<'a>) -> &'a str { hash.0