Struct redact::Secret

source ·
pub struct Secret<T>(_);
Expand description

Implementations§

source§

impl<T> Secret<T>

source

pub const fn new(secret: T) -> Self

source

pub fn from(secret: impl Into<T>) -> Self

source

pub fn try_from<U: TryInto<T>>(secret: U) -> Result<Self, Secret<U::Error>>

source

pub const fn expose_secret(&self) -> &T

Trait Implementations§

source§

impl<T, U> Add<Secret<U>> for Secret<T>where T: Add<U>,

§

type Output = Secret<<T as Add<U>>::Output>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Secret<U>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, U> AddAssign<Secret<U>> for Secret<T>where T: AddAssign<U>,

source§

fn add_assign(&mut self, rhs: Secret<U>)

Performs the += operation. Read more
source§

impl<T, U> BitAnd<Secret<U>> for Secret<T>where T: BitAnd<U>,

§

type Output = Secret<<T as BitAnd<U>>::Output>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Secret<U>) -> Self::Output

Performs the & operation. Read more
source§

impl<T, U> BitAndAssign<Secret<U>> for Secret<T>where T: BitAndAssign<U>,

source§

fn bitand_assign(&mut self, rhs: Secret<U>)

Performs the &= operation. Read more
source§

impl<T, U> BitOr<Secret<U>> for Secret<T>where T: BitOr<U>,

§

type Output = Secret<<T as BitOr<U>>::Output>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Secret<U>) -> Self::Output

Performs the | operation. Read more
source§

impl<T, U> BitOrAssign<Secret<U>> for Secret<T>where T: BitOrAssign<U>,

source§

fn bitor_assign(&mut self, rhs: Secret<U>)

Performs the |= operation. Read more
source§

impl<T, U> BitXor<Secret<U>> for Secret<T>where T: BitXor<U>,

§

type Output = Secret<<T as BitXor<U>>::Output>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Secret<U>) -> Self::Output

Performs the ^ operation. Read more
source§

impl<T, U> BitXorAssign<Secret<U>> for Secret<T>where T: BitXorAssign<U>,

source§

fn bitxor_assign(&mut self, rhs: Secret<U>)

Performs the ^= operation. Read more
source§

impl<T: Clone> Clone for Secret<T>

source§

fn clone(&self) -> Secret<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Secret<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default> Default for Secret<T>

source§

fn default() -> Secret<T>

Returns the “default value” for a type. Read more
source§

impl<'de, T: Deserialize<'de>> Deserialize<'de> for Secret<T>

This API requires the following crate features to be activated: serde

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl<E: Error> Display for Secret<E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, U> Div<Secret<U>> for Secret<T>where T: Div<U>,

§

type Output = Secret<<T as Div<U>>::Output>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Secret<U>) -> Self::Output

Performs the / operation. Read more
source§

impl<T, U> DivAssign<Secret<U>> for Secret<T>where T: DivAssign<U>,

source§

fn div_assign(&mut self, rhs: Secret<U>)

Performs the /= operation. Read more
source§

impl<T: Dummy<U>, U> Dummy<U> for Secret<T>

source§

fn dummy_with_rng<R: Rng + ?Sized>(config: &U, rng: &mut R) -> Self

Generate a dummy value for a given type using a random number generator.
source§

fn dummy(config: &U) -> Self

Generate a dummy value for a type. Read more
source§

impl<E: Error> Error for Secret<E>

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl<T> From<Option<Secret<T>>> for Secret<Option<T>>

source§

fn from(secret: Option<Secret<T>>) -> Self

Converts to this type from the input type.
source§

impl<T, E> From<Result<Secret<T>, E>> for Secret<Result<T, E>>

source§

fn from(secret: Result<Secret<T>, E>) -> Self

Converts to this type from the input type.
source§

impl<T, E> From<Result<Secret<T>, Secret<E>>> for Secret<Result<T, E>>

source§

fn from(secret: Result<Secret<T>, Secret<E>>) -> Self

Converts to this type from the input type.
source§

impl<T, E> From<Result<T, Secret<E>>> for Secret<Result<T, E>>

source§

fn from(secret: Result<T, Secret<E>>) -> Self

Converts to this type from the input type.
source§

impl<T> From<T> for Secret<T>

source§

fn from(secret: T) -> Self

Converts to this type from the input type.
source§

impl<S: FromIterator<T>, T> FromIterator<Secret<T>> for Secret<S>

source§

fn from_iter<I: IntoIterator<Item = Secret<T>>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl<T: FromStr> FromStr for Secret<T>

§

type Err = Secret<<T as FromStr>::Err>

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<T: Hash> Hash for Secret<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T, U> Mul<Secret<U>> for Secret<T>where T: Mul<U>,

§

type Output = Secret<<T as Mul<U>>::Output>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Secret<U>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, U> MulAssign<Secret<U>> for Secret<T>where T: MulAssign<U>,

source§

fn mul_assign(&mut self, rhs: Secret<U>)

Performs the *= operation. Read more
source§

impl<T> Neg for Secret<T>where T: Neg,

§

type Output = Secret<<T as Neg>::Output>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T> Not for Secret<T>where T: Not,

§

type Output = Secret<<T as Not>::Output>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<T: Ord> Ord for Secret<T>

source§

fn cmp(&self, other: &Secret<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<T: PartialEq> PartialEq<Secret<T>> for Secret<T>

source§

fn eq(&self, other: &Secret<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd> PartialOrd<Secret<T>> for Secret<T>

source§

fn partial_cmp(&self, other: &Secret<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T, U> Rem<Secret<U>> for Secret<T>where T: Rem<U>,

§

type Output = Secret<<T as Rem<U>>::Output>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Secret<U>) -> Self::Output

Performs the % operation. Read more
source§

impl<T, U> RemAssign<Secret<U>> for Secret<T>where T: RemAssign<U>,

source§

fn rem_assign(&mut self, rhs: Secret<U>)

Performs the %= operation. Read more
source§

impl<T, U> Shl<Secret<U>> for Secret<T>where T: Shl<U>,

§

type Output = Secret<<T as Shl<U>>::Output>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: Secret<U>) -> Self::Output

Performs the << operation. Read more
source§

impl<T, U> ShlAssign<Secret<U>> for Secret<T>where T: ShlAssign<U>,

source§

fn shl_assign(&mut self, rhs: Secret<U>)

Performs the <<= operation. Read more
source§

impl<T, U> Shr<Secret<U>> for Secret<T>where T: Shr<U>,

§

type Output = Secret<<T as Shr<U>>::Output>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: Secret<U>) -> Self::Output

Performs the >> operation. Read more
source§

impl<T, U> ShrAssign<Secret<U>> for Secret<T>where T: ShrAssign<U>,

source§

fn shr_assign(&mut self, rhs: Secret<U>)

Performs the >>= operation. Read more
source§

impl<T, U> Sub<Secret<U>> for Secret<T>where T: Sub<U>,

§

type Output = Secret<<T as Sub<U>>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Secret<U>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, U> SubAssign<Secret<U>> for Secret<T>where T: SubAssign<U>,

source§

fn sub_assign(&mut self, rhs: Secret<U>)

Performs the -= operation. Read more
source§

impl<T: Copy> Copy for Secret<T>

source§

impl<T: Eq> Eq for Secret<T>

source§

impl<T> StructuralEq for Secret<T>

source§

impl<T> StructuralPartialEq for Secret<T>

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Fake for T

source§

fn fake<U>(&self) -> Uwhere Self: FakeBase<U>,

source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> Uwhere R: Rng + ?Sized, Self: FakeBase<U>,

source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<E> Provider for Ewhere E: Error + ?Sized,

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,