pub struct SecretString(/* private fields */);Expand description
A header value that is never rendered by Debug or Display.
Redaction is a property of this type rather than of each container, so every
struct that derives Debug inherits it without a rule for contributors to
remember.
This type deliberately does not implement serde::Serialize. Adding
#[derive(Serialize)] to any struct holding one is therefore a compile
error rather than a silent credential leak into a config dump, a state
snapshot, or a session-persistence layer.
Implementations§
Source§impl SecretString
impl SecretString
Sourcepub fn new(value: impl Into<String>) -> SecretString
pub fn new(value: impl Into<String>) -> SecretString
Wraps a value that must not be logged.
Sourcepub fn expose_secret(&self) -> &str
pub fn expose_secret(&self) -> &str
Returns the wrapped value.
This is the single grep-able point at which a secret becomes visible.
Trait Implementations§
Source§impl Clone for SecretString
impl Clone for SecretString
Source§fn clone(&self) -> SecretString
fn clone(&self) -> SecretString
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecretString
impl Debug for SecretString
Source§impl<'de> Deserialize<'de> for SecretString
impl<'de> Deserialize<'de> for SecretString
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SecretString, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SecretString, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SecretString
Source§impl<T> From<T> for SecretString
impl<T> From<T> for SecretString
Source§fn from(value: T) -> SecretString
fn from(value: T) -> SecretString
Converts to this type from the input type.
Source§impl PartialEq for SecretString
impl PartialEq for SecretString
impl StructuralPartialEq for SecretString
Auto Trait Implementations§
impl Forget for SecretString
impl Freeze for SecretString
impl RefUnwindSafe for SecretString
impl Send for SecretString
impl Sync for SecretString
impl Unpin for SecretString
impl UnsafeUnpin for SecretString
impl UnwindSafe for SecretString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more