use super::*;
impl SecretString {
pub fn new<S>(value: S) -> Self
where
S: Into<String>,
{
Self {
inner: value.into(),
}
}
#[inline(always)]
pub fn expose(&self) -> &str {
let Self { inner } = self;
inner.as_str()
}
#[inline(always)]
pub fn len(&self) -> usize {
let Self { inner } = self;
inner.len()
}
#[inline(always)]
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
impl fmt::Debug for SecretString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(REDACTED_MARKER)
}
}
impl fmt::Display for SecretString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(REDACTED_MARKER)
}
}