diff --git a/hybrid-array/CHANGELOG.md b/hybrid-array/CHANGELOG.md index 2dac4530..1bb9a9c4 100644 --- a/hybrid-array/CHANGELOG.md +++ b/hybrid-array/CHANGELOG.md @@ -5,5 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Pending + +* Implement `Zeroize` for `Array`, and `ZeroizeOnDrop` for `Array` + ## 0.1.0 (2022-05-07) - Initial release diff --git a/hybrid-array/Cargo.toml b/hybrid-array/Cargo.toml index f88bdc6e..0d2800e3 100644 --- a/hybrid-array/Cargo.toml +++ b/hybrid-array/Cargo.toml @@ -18,4 +18,8 @@ rust-version = "1.65" [dependencies] typenum = "1.17" -zeroize = { version = "1.7", path = "../zeroize" } +zeroize = { version = "1.7", path = "../zeroize", optional = true } + +[features] +default = [] +zeroize = ["dep:zeroize"] diff --git a/hybrid-array/README.md b/hybrid-array/README.md index 86093c1c..f2914894 100644 --- a/hybrid-array/README.md +++ b/hybrid-array/README.md @@ -25,6 +25,12 @@ possible with the stable implementation of const generics: Internally the crate is built on const generics and provides traits which make it possible to convert between const generic types and `typenum` types. +## Features + +This crate exposes the following feature flags. The default is NO features. + +* [`zeroize`] - Implements [`Zeroize`](https://docs.rs/zeroize/latest/zeroize/trait.Zeroize.html) for `Array` + ## License Licensed under either of: diff --git a/hybrid-array/src/impls.rs b/hybrid-array/src/impls.rs index fab04416..bad5640a 100644 --- a/hybrid-array/src/impls.rs +++ b/hybrid-array/src/impls.rs @@ -1,6 +1,9 @@ use super::{Array, ArrayOps, ArraySize, IntoArray}; + +#[cfg(feature = "zeroize")] use zeroize::{Zeroize, ZeroizeOnDrop}; +#[cfg(feature = "zeroize")] impl Zeroize for Array where T: Zeroize, @@ -11,6 +14,7 @@ where } } +#[cfg(feature = "zeroize")] impl ZeroizeOnDrop for Array where T: ZeroizeOnDrop,