pub struct Secret<T>(/* private fields */);Expand description
A wrapper that redacts its contents in Debug logs and Serialization (UI/API), requiring explicit method calls to access the underlying value.
Implementations§
Source§impl<T> Secret<T>
impl<T> Secret<T>
Sourcepub fn expose_secret(&self) -> &T
pub fn expose_secret(&self) -> &T
Explicitly exposes the secret by reference.
Sourcepub fn expose_owned_secret(self) -> T
pub fn expose_owned_secret(self) -> T
Consumes the wrapper and returns the raw secret.
pub fn into_secret<U>(self) -> Secret<U>where
T: Into<U>,
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Secret<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Secret<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for Secret<T>where
T: Freeze,
impl<T> RefUnwindSafe for Secret<T>where
T: RefUnwindSafe,
impl<T> Send for Secret<T>where
T: Send,
impl<T> Sync for Secret<T>where
T: Sync,
impl<T> Unpin for Secret<T>where
T: Unpin,
impl<T> UnsafeUnpin for Secret<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Secret<T>where
T: UnwindSafe,
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