Flatten in generic_array::sequence - Rust

pub unsafe trait Flatten<T, N, M>: GenericSequence<GenericArray<T, N>, Length = M>

where N: ArrayLength + Mul<M>, Prod<N, M>: ArrayLength,

{ type Output: GenericSequence<T, Length = Prod<N, M>>; // Required method fn flatten(self) -> Self::Output; }
Expand description

Defines a GenericSequence of GenericArrays which can be flattened into a single GenericArray, at zero cost.

§Safety

While the flatten method is marked safe, care must be taken when implementing it. However, the given trait bounds should be sufficient to ensure safety.

Source

Flattens the sequence into a single GenericArray.

§Example
assert_eq!(
    arr![arr![1, 2], arr![3, 4], arr![5, 6]].flatten(),
    arr![1, 2, 3, 4, 5, 6]
);

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.