literate_crypto/util.rs
1mod iter;
2
3pub(crate) use iter::{CollectVec, IterChunks};
4
5/// Resize an array by either appending the default value or truncating.
6pub fn resize<T: Default + Copy, const N: usize, const R: usize>(num: [T; N]) -> [T; R] {
7 let mut result = [Default::default(); R];
8 result.iter_mut().zip(num.iter()).for_each(|(a, b)| *a = *b);
9 result
10}