diff --git a/Cargo.lock b/Cargo.lock index cfb5c001..e16b42ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,6 +85,7 @@ name = "hybrid-array" version = "0.2.0-pre.5" dependencies = [ "typenum", + "zeroize 1.7.0", ] [[package]] diff --git a/hybrid-array/Cargo.toml b/hybrid-array/Cargo.toml index 9d17e836..f88bdc6e 100644 --- a/hybrid-array/Cargo.toml +++ b/hybrid-array/Cargo.toml @@ -18,3 +18,4 @@ rust-version = "1.65" [dependencies] typenum = "1.17" +zeroize = { version = "1.7", path = "../zeroize" } diff --git a/hybrid-array/src/impls.rs b/hybrid-array/src/impls.rs index 72cf3e31..8e852450 100644 --- a/hybrid-array/src/impls.rs +++ b/hybrid-array/src/impls.rs @@ -1,4 +1,15 @@ use super::{Array, ArrayOps, ArraySize, IntoArray}; +use zeroize::Zeroize; + +impl Zeroize for Array +where + T: Zeroize, + U: ArraySize, +{ + fn zeroize(&mut self) { + self.0.as_mut().iter_mut().zeroize() + } +} macro_rules! impl_array_size { ($($len:expr => $ty:ident),+) => {