generic_array::sequence

Trait Unflatten

Source
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.

Required Associated Types§

Source

type Output: GenericSequence<GenericArray<T, N>, Length = Quot<NM, N>>

Unflattened sequence type

Required Methods§

Source

fn unflatten(self) -> Self::Output

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]]
);

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<'a, T, NM, N> Unflatten<T, NM, N> for &'a GenericArray<T, NM>
where NM: ArrayLength + Div<N>, N: ArrayLength, Quot<NM, N>: ArrayLength,

Source§

type Output = &'a GenericArray<GenericArray<T, N>, <NM as Div<N>>::Output>

Source§

impl<'a, T, NM, N> Unflatten<T, NM, N> for &'a mut GenericArray<T, NM>
where NM: ArrayLength + Div<N>, N: ArrayLength, Quot<NM, N>: ArrayLength,

Source§

type Output = &'a mut GenericArray<GenericArray<T, N>, <NM as Div<N>>::Output>

Source§

impl<T, NM, N> Unflatten<T, NM, N> for GenericArray<T, NM>
where NM: ArrayLength + Div<N>, N: ArrayLength, Quot<NM, N>: ArrayLength,