Unflatten in generic_array::sequence - Rust

pub unsafe trait Unflatten<T, NM, N>: GenericSequence<T, Length = NM>

where NM: ArrayLength + Div<N>, N: ArrayLength, Quot<NM, N>: ArrayLength,

{ type Output: GenericSequence<GenericArray<T, N>, Length = Quot<NM, N>>; // Required method fn unflatten(self) -> Self::Output; }
Expand description

Defines a GenericSequence of T which can be split evenly into a sequence of GenericArrays,

§Safety

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

Source

Unflattened sequence type

Source

Unflattens the sequence into a sequence of GenericArrays.

§Example
assert_eq!(
    arr![1, 2, 3, 4, 5, 6].unflatten(),
    arr![arr![1, 2], arr![3, 4], arr![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.