diff --git a/src/util.rs b/src/util.rs index 865416b..22cead1 100644 --- a/src/util.rs +++ b/src/util.rs @@ -43,6 +43,13 @@ macro_rules! utf8_to_utf16_array { } } +pub fn vec_to_array(vec: Vec) -> [T; N] { + let mut result: [T; N] = [T::default(); N]; + for (i, v) in vec.into_iter().enumerate() { + result[i] = v + } + result +} #[cfg(test)] mod test {