Skip to content

Commit

Permalink
Implement from_vec
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyob94 committed Sep 14, 2024
1 parent 476f251 commit 2d7744e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ impl FromStr for SecretString {
/// Convenient type alias for Secret Wrapped Vectors
pub type SecretVec<T> = SecretBox<Vec<T>>;

impl<T: Zeroize> SecretVec<T> {
#[allow(dead_code)]
fn from_vec(new_vec: Vec<T>) -> Self {
SecretBox::new(Box::new(new_vec))
}
}

impl<S: Zeroize> Drop for SecretBox<S> {
fn drop(&mut self) {
let len = size_of_val(&*self.inner_secret);
Expand Down

0 comments on commit 2d7744e

Please sign in to comment.