Trait SliceExt

pub trait SliceExt<T>: Sealed

Extension trait for [T] providing methods for working with Array.

Required Methods

fn as_hybrid_array<U: ArraySize>(&self) -> Option<&Array<T, U>>

Get a reference to an array from a slice, if the slice is exactly the size of the array.

Returns None if the slice's length is not exactly equal to the array size.

fn as_mut_hybrid_array<U: ArraySize>(&mut self) -> Option<&mut Array<T, U>>

Get a mutable reference to an array from a slice, if the slice is exactly the size of the array.

Returns None if the slice's length is not exactly equal to the array size.

fn as_hybrid_chunks<U: ArraySize>(&self) -> (&[Array<T, U>], &[T])

Splits the shared slice into a slice of U-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than U.

Panics

If U is 0.

fn as_hybrid_chunks_mut<U: ArraySize>(&mut self) -> (&mut [Array<T, U>], &mut [T])

Splits the exclusive slice into a slice of U-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than U.

Panics

If U is 0.

Implementors