Struct Zeroizing

#[repr(transparent)]
pub struct Zeroizing<Z: Zeroize + ?Sized>(/* private field */);

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

Zeroizing<T> is defined with repr(transparent), which means it is guaranteed to have the same physical representation as the underlying type.

Implementations

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

fn new(value: Z) -> Self

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

Trait Implementations

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

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

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

fn as_ref(&self) -> &T

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

type Target = Z;
fn deref(&self) -> &Z

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

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

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

fn drop(&mut self)

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

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

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

fn zeroize(&mut self)

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

impl<Z: Debug + Zeroize + ?Sized> Debug for Zeroizing<Z>

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

impl<Z: Default + Zeroize + ?Sized> Default for Zeroizing<Z>

fn default() -> Zeroizing<Z>

impl<Z: Eq + Zeroize + ?Sized> Eq for Zeroizing<Z>

impl<Z: PartialEq + Zeroize + ?Sized> PartialEq for Zeroizing<Z>

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

impl<Z: PartialEq + Zeroize + ?Sized> StructuralPartialEq for Zeroizing<Z>

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

fn clone(&self) -> Self
fn clone_from(&mut self, source: &Self)

Auto Trait Implementations

impl<Z> Freeze for Zeroizing<Z> where Z: Freeze + ?Sized,

impl<Z> RefUnwindSafe for Zeroizing<Z> where Z: RefUnwindSafe + ?Sized,

impl<Z> Send for Zeroizing<Z> where Z: Send + ?Sized,

impl<Z> Sync for Zeroizing<Z> where Z: Sync + ?Sized,

impl<Z> Unpin for Zeroizing<Z> where Z: Unpin + ?Sized,

impl<Z> UnsafeUnpin for Zeroizing<Z> where Z: UnsafeUnpin + ?Sized,

impl<Z> UnwindSafe for Zeroizing<Z> where Z: UnwindSafe + ?Sized,

Blanket Implementations

impl<P, T> Receiver for Zeroizing<Z> where P: Deref<Target = T> + ?Sized, T: ?Sized,

type Target = T;

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Zeroizing<Z>

fn from(t: T) -> T

Returns the argument unchanged.

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Zeroizing<Z> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for Zeroizing<Z> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Zeroizing<Z> where U: TryFrom<T>,

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