pub struct SecretString(/* private fields */);Expand description
Implementations§
Source§impl SecretString
impl SecretString
Sourcepub fn expose_secret(&self) -> &str
pub fn expose_secret(&self) -> &str
Borrows the secret as a &str for use without taking ownership.
All uses of this function should be carefully reviewed to ensure the value is not printed or copied to a non-Secret-wrapped storage. The borrow does not change ownership and the secret is still zeroed on drop.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the wrapper and returns the plain owned String.
This is the ownership-handoff path for when a secret must leave the
library boundary. The moved-out value is not zeroized (that is the
point of handoff); the caller then owns leak prevention. No wrapped copy
remains, because self is consumed by value.
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 Drop for SecretString
impl Drop for SecretString
Source§impl From<String> for SecretString
impl From<String> for SecretString
Auto Trait Implementations§
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