Function hugr_core::utils::collect_array
source · pub fn collect_array<const N: usize, T: Debug>(
arr: impl IntoIterator<Item = T>,
) -> [T; N]Expand description
Collect a vector into an array.
This is useful for deconstructing a vectors content.
§Example
ⓘ
let iter = 0..3;
let [a, b, c] = crate::utils::collect_array(iter);
assert_eq!(b, 1);§Panics
If the length of the slice is not equal to N.
See also try_collect_array for a non-panicking version.