Skip to content

Commit 07fa4bb

Browse files
authored
mcf: impl Display for PasswordHashRef (#2114)
It's a `str` newtype, so make it possible to display the underlying string
1 parent a20bcb8 commit 07fa4bb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mcf/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ mod base64;
2020
mod error;
2121
mod fields;
2222

23+
use core::fmt;
2324
pub use error::{Error, Result};
2425
pub use fields::{Field, Fields};
2526

@@ -71,6 +72,12 @@ impl<'a> PasswordHashRef<'a> {
7172
}
7273
}
7374

75+
impl fmt::Display for PasswordHashRef<'_> {
76+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
77+
f.write_str(self.as_str())
78+
}
79+
}
80+
7481
impl<'a> From<PasswordHashRef<'a>> for &'a str {
7582
fn from(hash: PasswordHashRef<'a>) -> &'a str {
7683
hash.0

0 commit comments

Comments
 (0)