| { | ||
| "git": { | ||
| "sha1": "4ab6d63958e7c1892c6ed5113a26fab52fbb0efe" | ||
| "sha1": "2c92a59bed0d1669cede3806000d2e61d5994c4e" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
@@ -25,2 +25,3 @@ on: | ||
| features: | ||
| bench: true | ||
| experimental: false | ||
@@ -31,3 +32,3 @@ - rust: beta | ||
| - rust: nightly | ||
| features: serde | ||
| features: serde, zeroize | ||
| experimental: false | ||
@@ -62,2 +63,2 @@ | ||
| - name: Test with Miri | ||
| run: cargo miri test | ||
| run: cargo miri test --all-features |
+10
-2
@@ -15,3 +15,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "arrayvec" | ||
| version = "0.7.3" | ||
| version = "0.7.4" | ||
| authors = ["bluss"] | ||
@@ -36,3 +36,6 @@ description = "A vector with fixed capacity, backed by an array (it can be stored on the stack too). Implements fixed capacity ArrayVec and ArrayString." | ||
| [package.metadata.docs.rs] | ||
| features = ["serde"] | ||
| features = [ | ||
| "serde", | ||
| "zeroize", | ||
| ] | ||
@@ -62,2 +65,7 @@ [package.metadata.release] | ||
| [dependencies.zeroize] | ||
| version = "1.4" | ||
| optional = true | ||
| default-features = false | ||
| [dev-dependencies.bencher] | ||
@@ -64,0 +72,0 @@ version = "0.1.4" |
+4
-0
| Recent Changes (arrayvec) | ||
| ========================= | ||
| ## 0.7.4 | ||
| - Add feature zeroize to support the `Zeroize` trait by @elichai | ||
| ## 0.7.3 | ||
@@ -5,0 +9,0 @@ |
+24
-0
@@ -650,1 +650,25 @@ use std::borrow::{Borrow, BorrowMut}; | ||
| } | ||
| #[cfg(feature = "zeroize")] | ||
| /// "Best efforts" zeroing of the `ArrayString`'s buffer when the `zeroize` feature is enabled. | ||
| /// | ||
| /// The length is set to 0, and the buffer is dropped and zeroized. | ||
| /// Cannot ensure that previous moves of the `ArrayString` did not leave values on the stack. | ||
| /// | ||
| /// ``` | ||
| /// use arrayvec::ArrayString; | ||
| /// use zeroize::Zeroize; | ||
| /// let mut string = ArrayString::<6>::from("foobar").unwrap(); | ||
| /// string.zeroize(); | ||
| /// assert_eq!(string.len(), 0); | ||
| /// unsafe { string.set_len(string.capacity()) }; | ||
| /// assert_eq!(&*string, "\0\0\0\0\0\0"); | ||
| /// ``` | ||
| impl<const CAP: usize> zeroize::Zeroize for ArrayString<CAP> { | ||
| fn zeroize(&mut self) { | ||
| // There are no elements to drop | ||
| self.clear(); | ||
| // Zeroize the backing array. | ||
| self.xs.zeroize(); | ||
| } | ||
| } |
+26
-0
@@ -851,2 +851,28 @@ | ||
| #[cfg(feature = "zeroize")] | ||
| /// "Best efforts" zeroing of the `ArrayVec`'s buffer when the `zeroize` feature is enabled. | ||
| /// | ||
| /// The length is set to 0, and the buffer is dropped and zeroized. | ||
| /// Cannot ensure that previous moves of the `ArrayVec` did not leave values on the stack. | ||
| /// | ||
| /// ``` | ||
| /// use arrayvec::ArrayVec; | ||
| /// use zeroize::Zeroize; | ||
| /// let mut array = ArrayVec::from([1, 2, 3]); | ||
| /// array.zeroize(); | ||
| /// assert_eq!(array.len(), 0); | ||
| /// let data = unsafe { core::slice::from_raw_parts(array.as_ptr(), array.capacity()) }; | ||
| /// assert_eq!(data, [0, 0, 0]); | ||
| /// ``` | ||
| impl<Z: zeroize::Zeroize, const CAP: usize> zeroize::Zeroize for ArrayVec<Z, CAP> { | ||
| fn zeroize(&mut self) { | ||
| // Zeroize all the contained elements. | ||
| self.iter_mut().zeroize(); | ||
| // Drop all the elements and set the length to 0. | ||
| self.clear(); | ||
| // Zeroize the backing array. | ||
| self.xs.zeroize(); | ||
| } | ||
| } | ||
| /// By-value iterator for `ArrayVec`. | ||
@@ -853,0 +879,0 @@ pub struct IntoIter<T, const CAP: usize> { |
+4
-0
@@ -14,2 +14,6 @@ //! **arrayvec** provides the types [`ArrayVec`] and [`ArrayString`]: | ||
| //! | ||
| //! - `zeroize` | ||
| //! - Optional | ||
| //! - Implement `Zeroize` for ArrayVec and ArrayString | ||
| //! | ||
| //! ## Rust Version | ||
@@ -16,0 +20,0 @@ //! |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet