blob: 8f706465b8c64b81df5d43c00df267b6e871aca8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use std::fmt;
#[derive(PartialEq, Eq, sqlx::Type)]
#[sqlx(transparent)]
pub struct Secret(String);
impl Secret {
pub fn reveal(self) -> String {
let Self(secret) = self;
secret
}
}
impl fmt::Debug for Secret {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IdentityToken").field(&"********").finish()
}
}
impl<S> From<S> for Secret
where
S: Into<String>,
{
fn from(value: S) -> Self {
Self(value.into())
}
}
|