1 /*! |
1 /*! |
2 Utilities for mapping over various container types. |
2 Utilities for mapping over various container types. |
3 */ |
3 */ |
4 |
4 |
5 use itertools::izip; |
5 use itertools::izip; |
6 #[cfg(feature = "nightly")] |
6 #[cfg(nightly)] |
7 use std::mem::MaybeUninit; |
7 use std::mem::MaybeUninit; |
8 |
8 |
9 /// Trait for a fixed-length container type. |
9 /// Trait for a fixed-length container type. |
10 /// |
10 /// |
11 /// Implemented by [`Loc`][crate::loc::Loc] vectors, [`Cube`][crate::sets::Cube]s, |
11 /// Implemented by [`Loc`][crate::loc::Loc] vectors, [`Cube`][crate::sets::Cube]s, |
350 /// `next` at most `N` times, the iterator can still be used afterwards to |
350 /// `next` at most `N` times, the iterator can still be used afterwards to |
351 /// retrieve the remaining items. |
351 /// retrieve the remaining items. |
352 /// |
352 /// |
353 /// If `iter.next()` panicks, all items already yielded by the iterator are |
353 /// If `iter.next()` panicks, all items already yielded by the iterator are |
354 /// dropped. |
354 /// dropped. |
355 #[cfg(feature = "nightly")] |
355 #[cfg(nightly)] |
356 #[inline] |
356 #[inline] |
357 pub(crate) fn collect_into_array_unchecked<T, I: Iterator<Item = T>, const N: usize>( |
357 pub(crate) fn collect_into_array_unchecked<T, I: Iterator<Item = T>, const N: usize>( |
358 mut iter: I, |
358 mut iter: I, |
359 ) -> [T; N] { |
359 ) -> [T; N] { |
360 if N == 0 { |
360 if N == 0 { |