diff --git a/src/secret_vec.rs b/src/secret_vec.rs index 1df86a9..e5fe297 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 }) } @@ -432,7 +432,7 @@ mod test { #[test] fn it_allows_failing_initialization() { - assert!(SecretVec::::try_new(|_| Ok::<(), ()>(())).is_ok()); + assert!(SecretVec::::try_new(8, |_| Ok::<(), ()>(())).is_ok()); } #[test]