Skip to main content

ZeroizablePrimitive

Trait ZeroizablePrimitive 

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

Source

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 ZeroizablePrimitive for bool

Source§

const ZEROED: Self = false

Source§

impl ZeroizablePrimitive for char

Source§

const ZEROED: Self = '\0'

Source§

impl ZeroizablePrimitive for i8

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for i16

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for i32

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for i64

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for i128

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for isize

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for u8

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for u16

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for u32

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for u64

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for u128

Source§

const ZEROED: Self

Source§

impl ZeroizablePrimitive for usize

Source§

const ZEROED: Self

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.

Source§

const ZEROED: Self

Implementors§