pub struct Secret<S> where
S: Zeroize, { /* private fields */ }
Expand description
Wrapper type for values that contains secrets, which attempts to limit accidental exposure and ensure secrets are wiped from memory when dropped. (e.g. passwords, cryptographic keys, access tokens or other credentials)
Access to the secret inner value occurs through the ExposeSecret
trait,
which provides an expose_secret()
method for accessing the inner secret
value.
Implementations
Trait Implementations
sourceimpl<S> Clone for Secret<S> where
S: CloneableSecret,
impl<S> Clone for Secret<S> where
S: CloneableSecret,
sourceimpl<S> Debug for Secret<S> where
S: Zeroize + DebugSecret,
impl<S> Debug for Secret<S> where
S: Zeroize + DebugSecret,
sourceimpl<S> ExposeSecret<S> for Secret<S> where
S: Zeroize,
impl<S> ExposeSecret<S> for Secret<S> where
S: Zeroize,
sourcefn expose_secret(&self) -> &S
fn expose_secret(&self) -> &S
Expose secret: this is the only method providing access to a secret.
Auto Trait Implementations
impl<S> RefUnwindSafe for Secret<S> where
S: RefUnwindSafe,
impl<S> Send for Secret<S> where
S: Send,
impl<S> Sync for Secret<S> where
S: Sync,
impl<S> Unpin for Secret<S> where
S: Unpin,
impl<S> UnwindSafe for Secret<S> where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more