Skip to main content
This is unreleased documentation for the main (development) branch of crypto-glue.

Zeroizing

Struct Zeroizing 

Source
pub struct Zeroizing<Z>(/* private fields */)
where
    Z: Zeroize;
Expand description

Zeroizing is a a wrapper for any Z: Zeroize type which implements a Drop handler which zeroizes dropped values.

Implementations§

Source§

impl<Z> Zeroizing<Z>
where Z: Zeroize,

Source

pub fn new(value: Z) -> Zeroizing<Z>

Move value inside a Zeroizing wrapper which ensures it will be zeroized when it’s dropped.

Trait Implementations§

Source§

impl<T, Z> AsMut<T> for Zeroizing<Z>
where Z: AsMut<T> + Zeroize, T: ?Sized,

Source§

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

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T, Z> AsRef<T> for Zeroizing<Z>
where Z: AsRef<T> + Zeroize, T: ?Sized,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<Z> Clone for Zeroizing<Z>
where Z: Zeroize + Clone,

Source§

fn clone(&self) -> Zeroizing<Z>

Returns a duplicate of the value. Read more
Source§

fn clone_from(&mut self, source: &Zeroizing<Z>)

Performs copy-assignment from source. Read more
Source§

impl<Z> Debug for Zeroizing<Z>
where Z: Debug + Zeroize,

Source§

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

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

impl<Z> Default for Zeroizing<Z>
where Z: Default + Zeroize,

Source§

fn default() -> Zeroizing<Z>

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

impl<Z> Deref for Zeroizing<Z>
where Z: Zeroize,

Source§

type Target = Z

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Z

Dereferences the value.
Source§

impl<Z> DerefMut for Zeroizing<Z>
where Z: Zeroize,

Source§

fn deref_mut(&mut self) -> &mut Z

Mutably dereferences the value.
Source§

impl<'de, Z> Deserialize<'de> for Zeroizing<Z>
where Z: Zeroize + Deserialize<'de>,

Available on crate feature serde only.
Source§

fn deserialize<D>( deserializer: D, ) -> Result<Zeroizing<Z>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

impl<Z> Drop for Zeroizing<Z>
where Z: Zeroize,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<Z> From<Z> for Zeroizing<Z>
where Z: Zeroize,

Source§

fn from(value: Z) -> Zeroizing<Z>

Converts to this type from the input type.
Source§

impl<Z> PartialEq for Zeroizing<Z>
where Z: PartialEq + Zeroize,

Source§

fn eq(&self, other: &Zeroizing<Z>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Z> Serialize for Zeroizing<Z>
where Z: Zeroize + Serialize,

Available on crate feature serde only.
Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<Z> Zeroize for Zeroizing<Z>
where Z: Zeroize,

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<Z> Eq for Zeroizing<Z>
where Z: Eq + Zeroize,

Source§

impl<Z> StructuralPartialEq for Zeroizing<Z>
where Z: Zeroize,

Source§

impl<Z> ZeroizeOnDrop for Zeroizing<Z>
where Z: Zeroize,

Auto Trait Implementations§

§

impl<Z> Freeze for Zeroizing<Z>
where Z: Freeze,

§

impl<Z> RefUnwindSafe for Zeroizing<Z>
where Z: RefUnwindSafe,

§

impl<Z> Send for Zeroizing<Z>
where Z: Send,

§

impl<Z> Sync for Zeroizing<Z>
where Z: Sync,

§

impl<Z> Unpin for Zeroizing<Z>
where Z: Unpin,

§

impl<Z> UnsafeUnpin for Zeroizing<Z>
where Z: UnsafeUnpin,

§

impl<Z> UnwindSafe for Zeroizing<Z>
where Z: UnwindSafe,

Blanket Implementations§

Source§

impl<R> TryRngCore for R
where R: TryRng,

Source§

type Error = <R as TryRng>::Error

👎Deprecated since 0.10.0: use TryRng instead
Error type.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<R> Rng for R
where R: TryRng<Error = Infallible> + ?Sized,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32.
Source§

fn next_u64(&mut self) -> u64

Return the next random u64.
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToHex for T
where T: AsRef<[u8]>,

Source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
Source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<R> TryRng for R
where R: DerefMut, <R as Deref>::Target: TryRng,

Source§

type Error = <<R as Deref>::Target as TryRng>::Error

The type returned in the event of a RNG error. Read more
Source§

fn try_next_u32(&mut self) -> Result<u32, <R as TryRng>::Error>

Return the next random u32.
Source§

fn try_next_u64(&mut self) -> Result<u64, <R as TryRng>::Error>

Return the next random u64.
Source§

fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), <R as TryRng>::Error>

Fill dst entirely with random data.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<R> CryptoRng for R
where R: TryCryptoRng<Error = Infallible> + ?Sized,

Source§

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

Source§

impl<R> RngCore for R
where R: Rng,

Source§

impl<R> TryCryptoRng for R
where R: DerefMut, <R as Deref>::Target: TryCryptoRng,