diff --git a/src/secret_vec.rs b/src/secret_vec.rs index 1df86a9..afd8a61 100644 --- a/src/secret_vec.rs +++ b/src/secret_vec.rs @@ -190,11 +190,11 @@ impl SecretVec { /// # Errors /// /// Returns `Err` only if the user-provided callback does. - pub fn try_new(f: F) -> Result + pub fn try_new(len: usize, f: F) -> Result where F: FnOnce(&mut [T]) -> Result, { - Box::try_new(1, |b| f(b.as_mut_slice())) + Box::try_new(len, |b| f(b.as_mut_slice())) .map(|b| Self { boxed: b }) }