pub struct Secret<T>(/* private fields */);
Expand description
Wraps a type T
, preventing it from being accidentally revealed.
Implementations§
source§impl<T> Secret<T>
impl<T> Secret<T>
sourcepub fn reveal_into(self) -> T
pub fn reveal_into(self) -> T
Reveal the held value by unwrapping
sourcepub fn map_revealed<V, F: FnOnce(T) -> V>(self, f: F) -> Secret<V>
pub fn map_revealed<V, F: FnOnce(T) -> V>(self, f: F) -> Secret<V>
Reveals the held value by applying a function to it
Trait Implementations§
source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for Secret<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for Secret<T>
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
impl<T: Copy> Copy for Secret<T>
impl<T: Eq> Eq for Secret<T>
impl<T: Send> Send for Secret<T>
impl<T: Sync> Sync 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> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)