https://docs.rs/arrayvec/0.6.0/arrayvec/struct.ArrayVec.html#method.into_inner
Nice! ArrayVec's API now integrates perfectly with Rust const generics.
This is surprisingly useful for initializing arrays generically. Eg:
fn foo<T, U, const N: usize>(src: [T; N]) -> [U; N])
where T: Foo<U>
{
let mut r: ArrayVec<N> = ArrayVec::new();
for item in src {
r.push(item.foo());
}
r.into_inner().ok().unwrap()
}
On that basis alone I think ArrayVec should be added to the standard library. The alternative is MaybeUninit yuck.