use std::fmt::{Debug, Formatter};
#[derive(serde::Deserialize, PartialEq, PartialOrd, Eq, Ord, Clone)]
#[repr(transparent)]
#[serde(transparent)]
pub struct SecretString(pub String);
impl Debug for SecretString {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let type_name = std::any::type_name::<Self>()
.rsplit_once("::")
.map_or(std::any::type_name::<Self>(), |(_, i)| i);
f.debug_struct(type_name).finish_non_exhaustive()
}
}
impl From<String> for SecretString {
fn from(value: String) -> Self {
Self(value)
}
}
impl From<SecretString> for String {
fn from(value: SecretString) -> Self {
value.0
}
}