logo
pub trait ArrayOps<T, const N: usize>: AsRef<[T; N]> + AsMut<[T; N]> + Borrow<[T; N]> + BorrowMut<[T; N]> + From<[T; N]> + Index<usize> + Index<Range<usize>> + IndexMut<usize> + IndexMut<Range<usize>> + IntoIterator + Sized {
    type Size: ArraySize<T>;

    const SIZE: usize;

    fn as_array_ref(&self) -> &[T; N];
    fn as_array_mut(&mut self) -> &mut [T; N];
    fn from_core_array(arr: [T; N]) -> Self;
    fn from_slice(slice: &[T]) -> Result<Self, TryFromSliceError>
    where
        T: Copy
; fn map<F, U>(self, f: F) -> [U; N]
    where
        F: FnMut(T) -> U
; fn from_fn<F>(cb: F) -> Self
    where
        F: FnMut(usize) -> T
, { ... } fn iter(&self) -> Iter<'_, T> { ... } fn iter_mut(&mut self) -> IterMut<'_, T> { ... } }
Expand description

Array operations which are const generic over a given array size.

Required Associated Types

ArraySize type: typenum-provided Unsigned integer.

Not to be confused with ArrayOps::SIZE, which is a usize.

Required Associated Constants

Size of an array as a usize.

Not to be confused with ArrayOps::Size, which is typenum-based.

Required Methods

Returns a reference to the inner array.

Returns a mutable reference to the inner array.

Create array from Rust’s core array type.

Create array from a slice.

Returns an array of the same size as self, with function f applied to each element in order.

Provided Methods

Create array where each array element T is returned by the cb call.

Returns an iterator over the array.

Returns an iterator that allows modifying each value.

Implementors