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-29.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-28.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-27.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-26.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-25.0.2 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-25.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-25.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-24.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-23.0.2 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-22.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-21.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-20.0.2 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-20.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-18.0.3 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-17.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-17.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-16.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-15.0.1 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-15.0.0 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs
wasmtime-14.0.4 ./ext/cargo-vendor/generic-array-0.14.7/src/impl_zeroize.rs