Struct shuttle_common::secrets::Secret
source · pub struct Secret<T: Zeroize>(/* private fields */);
Expand description
Wrapper type for secret values such as passwords or authentication keys.
Once wrapped, the inner value cannot leak accidentally, as both the std::fmt::Display
and Debug
implementations cover up the actual value and only show the type.
If you need access to the inner value, there is an expose method.
To make sure nothing leaks after the Secret
has been dropped, a custom Drop
implementation will zero-out the underlying memory.
Implementations§
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Secret<T>where
T: Deserialize<'de> + Zeroize,
impl<'de, T> Deserialize<'de> for Secret<T>where
T: Deserialize<'de> + Zeroize,
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
source§impl<T: PartialEq + Zeroize> PartialEq for Secret<T>
impl<T: PartialEq + Zeroize> PartialEq for Secret<T>
impl<T: Eq + Zeroize> Eq for Secret<T>
impl<T: Zeroize> StructuralPartialEq for Secret<T>
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> 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