DynamicZeroizing

Struct DynamicZeroizing 

Source
pub struct DynamicZeroizing<T: ?Sized + Zeroize>(/* private fields */);
Expand description

Zeroizing wrapper for heap-allocated secrets.

Uses secrecy::SecretBox<T> internally to prevent accidental cloning while still providing zeroization of the full allocation (including spare capacity).

Implementations§

Source§

impl<T: ?Sized + Zeroize> DynamicZeroizing<T>

Source

pub fn new(value: Box<T>) -> Self

Creates a new DynamicZeroizing from a boxed value.

The boxed value will be zeroed (including spare capacity) on drop.

Trait Implementations§

Source§

impl<T: ?Sized + Zeroize> Debug for DynamicZeroizing<T>

Available on crate feature zeroize only.
Source§

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

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

impl<S: ?Sized + Zeroize> ExposeSecret<S> for DynamicZeroizing<S>

Available on crate feature zeroize only.
Source§

fn expose_secret(&self) -> &S

Expose secret: this is the only method providing access to a secret.
Source§

impl From<&str> for DynamicZeroizing<String>

Available on crate feature zeroize only.
Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl<T: Zeroize + DefaultIsZeroes + Send + 'static> From<Box<T>> for DynamicZeroizing<T>

Available on crate feature zeroize only.
Source§

fn from(boxed: Box<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ?Sized + Zeroize> From<Dynamic<T>> for DynamicZeroizing<T>

Available on crate feature zeroize only.
Source§

fn from(dynamic: Dynamic<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Zeroize + Send + 'static> From<T> for DynamicZeroizing<T>

Available on crate feature zeroize only.

Ergonomic .into() support for zeroizing heap secrets.

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: Zeroize + DefaultIsZeroes> Zeroize for DynamicZeroizing<T>

Available on crate feature zeroize only.
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<T: ?Sized + Zeroize> ZeroizeOnDrop for DynamicZeroizing<T>

Available on crate feature zeroize only.

Auto Trait Implementations§

§

impl<T> Freeze for DynamicZeroizing<T>
where T: ?Sized,

§

impl<T> RefUnwindSafe for DynamicZeroizing<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Send for DynamicZeroizing<T>
where T: Send + ?Sized,

§

impl<T> Sync for DynamicZeroizing<T>
where T: Sync + ?Sized,

§

impl<T> Unpin for DynamicZeroizing<T>
where T: ?Sized,

§

impl<T> UnwindSafe for DynamicZeroizing<T>
where T: UnwindSafe + ?Sized,

Blanket Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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