Struct sec::Secret
[−]
[src]
pub struct Secret<T>(_);
Wraps a type T
, preventing it from being accidentally revealed.
Methods
impl Secret<String>
[src]
fn as_str(&self) -> Secret<&str>
[src]
Returns a str
reference, wrapped in a secret
fn reveal_str(&self) -> &str
[src]
Return and reveal a str
reference.
impl<T> Secret<T>
[src]
fn new(val: T) -> Secret<T>
[src]
Creates a new secret
fn as_ref(&self) -> Secret<&T>
[src]
Create a secret immutable reference
fn as_mut(&mut self) -> Secret<&mut T>
[src]
Create a secret mutable reference
fn reveal(&self) -> &T
[src]
Reveal the held value by returning a reference
fn reveal_into(self) -> T
[src]
Reveal the held value by unwrapping
fn map_revealed<V, F: FnOnce(T) -> V>(self, f: F) -> Secret<V>
[src]
Reveals the held value by applying a function to it
Trait Implementations
impl<T> Debug for Secret<T>
[src]
impl<T: Display> Display for Secret<T>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: Clone> Clone for Secret<T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for Secret<T>
[src]
fn eq(&self, other: &Secret<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T: Hash> Hash for Secret<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more