From ced949f9cd2927040c72614c73c23fe39755e9cf Mon Sep 17 00:00:00 2001 From: itaifish Date: Thu, 11 Dec 2025 15:00:21 -0500 Subject: [PATCH] Modify try_new to accept length parameter --- src/secret_vec.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 }) }