libutils_array/
conversions.rs1use super::Array;
7
8use alloc::vec::Vec;
10
11
12impl<Type, const M: usize, const N: usize> From<[Type; N]> for Array<Type, M> where [(); M - N]: {
18 #[inline]
19 fn from(value: [Type; N]) -> Self {return Array::from_iter(value)}
20}
21
22impl<Type, const N: usize> Into<Vec<Type>> for Array<Type, N> {
24 #[inline]
25 fn into(self) -> Vec<Type> {return Vec::from_iter(self.into_iter())}
26}
27
28impl<Type, const N: usize, Generator: FnMut(usize) -> Type> From<Generator> for Array<Type, N> {
30 #[inline]
31 fn from(mut value: Generator) -> Self {
32 let mut array = Self::new();
33 for index in 0..N {
34 array.push(value(index));
35 };
36 return array;
37 }
38}