[−][src]Function array_init::from_iter
pub fn from_iter<Array, I>(iter: I) -> Option<Array> where
I: IntoIterator<Item = Array::Item>,
Array: IsArray,
Initialize an array given an iterator
We will iterate until the array is full or the iterator is exhausted. Returns None if the iterator is exhausted before we can fill the array.
Examples
// Initialize an array from an iterator // producing an array of [1,2,3,4] repeated let four = [1u32,2,3,4]; let mut iter = four.iter().cloned().cycle(); let arr: [u32; 50] = array_init::from_iter(iter).unwrap();