pub trait ZeroizablePrimitive: Copy + Sized {
const ZEROED: Self;
}Expand description
A Copy type whose all-zero value is meaningful and valid, so that a Secret of it can be
default-constructed in a zeroed state.
This is used instead of Default for two reasons: it lets Secret::new produce a zeroed
value at compile time via an associated const, and – crucially – it works for arrays of any
length, whereas [T; N]: Default is only implemented for N <= 32.
Required Associated Constants§
Sourceconst ZEROED: Self
const ZEROED: Self
The zeroed value of this type.
This needs to be a valid static instance of Self that Secret::zeroize will internally
convert into a byte array and use to overwrite the memory location of the given instance of
the primitive.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<T: ZeroizablePrimitive, const N: usize> ZeroizablePrimitive for [T; N]
Blanket impl for fixed-size arrays of any length.
This is an alternative to [T; N]: Default which is capped at N <= 32.
impl<T: ZeroizablePrimitive, const N: usize> ZeroizablePrimitive for [T; N]
Blanket impl for fixed-size arrays of any length.
This is an alternative to [T; N]: Default which is capped at N <= 32.