Sha256: dd1af63ef2cba2120c6f775350c98eb12bb1be6ba784d5350d07d4ae5419c292

Contents?: true

Size: 510 Bytes

Versions: 33

Compression:

Stored size: 510 Bytes

Contents

use crate::{ArrayLength, GenericArray};

use zeroize::Zeroize;

impl<T: Zeroize, N: ArrayLength<T>> Zeroize for GenericArray<T, N> {
    fn zeroize(&mut self) {
        self.as_mut_slice().iter_mut().zeroize()
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_zeroize() {
        let mut array = GenericArray::<u8, typenum::U2>::default();
        array[0] = 4;
        array[1] = 9;
        array.zeroize();
        assert_eq!(array[0], 0);
        assert_eq!(array[1], 0);
    }
}

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
wasmtime-14.0.3 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-14.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-14.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-13.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-12.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-12.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-11.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-10.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-10.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-9.0.4 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-9.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-8.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-7.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs