generic_array::sequence

Trait Flatten

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

Required Associated Types§

Source

type Output: GenericSequence<T, Length = Prod<N, M>>

Flattened sequence type

Required Methods§

Source

fn flatten(self) -> Self::Output

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

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, N, M> Flatten<T, N, M> for &'a GenericArray<GenericArray<T, N>, M>
where N: ArrayLength + Mul<M>, M: ArrayLength, Prod<N, M>: ArrayLength,

Source§

type Output = &'a GenericArray<T, <N as Mul<M>>::Output>

Source§

impl<'a, T, N, M> Flatten<T, N, M> for &'a mut GenericArray<GenericArray<T, N>, M>
where N: ArrayLength + Mul<M>, M: ArrayLength, Prod<N, M>: ArrayLength,

Source§

type Output = &'a mut GenericArray<T, <N as Mul<M>>::Output>

Source§

impl<T, N, M> Flatten<T, N, M> for GenericArray<GenericArray<T, N>, M>
where N: ArrayLength + Mul<M>, M: ArrayLength, Prod<N, M>: ArrayLength,

Source§

type Output = GenericArray<T, <N as Mul<M>>::Output>