Trait array_math::ArrayOps

source ·
pub trait ArrayOps<T, const N: usize>: ArrayPrereq<Item = T> + IntoIterator + Borrow<[T; N]> + BorrowMut<[T; N]> {
Show 129 associated items type Array<I, const L: usize>: ArrayOps<I, L> = [I; L]; type PaddedItem<I, const W: usize>: Borrow<I> + BorrowMut<I> = Padded<I, W>; type PaddedArray<I, const W: usize, const L: usize>: ArrayOps<Self::PaddedItem<I, W>, L> = Self::Array<Self::PaddedItem<I, W>, L>; type Resized<const M: usize>: ArrayOps<T, M> = Self::Array<T, M>; type Chained<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::Chained::{constant#1}> = Self::Array<T, array_trait::::array_ops::ArrayOps::Chained::{constant#2}>; type RChained<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::RChained::{constant#1}> = Self::Array<T, array_trait::::array_ops::ArrayOps::RChained::{constant#2}>; type MappedTo<M>: ArrayOps<M, N> = Self::Array<M, N>; type Mapped<M: FnOnce(T)>: ArrayOps<<M as FnOnce(T)>::Output, N> = Self::MappedTo<<M as FnOnce(T)>::Output>; type Zipped<Z>: ArrayOps<(T, Z), N> = Self::MappedTo<(T, Z)>; type Enumerated: ArrayOps<(usize, T), N> = Self::MappedTo<usize>::Zipped<T>; type Differentiated: ArrayOps<<T as Sub>::Output, array_trait::::array_ops::ArrayOps::Differentiated::{constant#1}> = Self::Array<<T as Sub>::Output, array_trait::::array_ops::ArrayOps::Differentiated::{constant#2}> where T: Sub; type Split<const M: usize>: ArrayOps<T, M> = Self::Resized<M>; type RSplit<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::RSplit::{constant#1}> = Self::Resized<array_trait::::array_ops::ArrayOps::RSplit::{constant#2}>; type ResizedDiv<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::ResizedDiv::{constant#1}> = Self::Resized<array_trait::::array_ops::ArrayOps::ResizedDiv::{constant#2}>; type ResizedRem<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::ResizedRem::{constant#1}> = Self::Resized<array_trait::::array_ops::ArrayOps::ResizedRem::{constant#2}>; type Chunks<const M: usize>: ArrayOps<Self::Array<T, M>, array_trait::::array_ops::ArrayOps::Chunks::{constant#1}> = [Self::Array<T, M>; { _ }]; // Required methods fn split_len<const WRAPPING: bool>(n: usize) -> (usize, usize); fn rsplit_len<const WRAPPING: bool>(n: usize) -> (usize, usize); fn split_ptr<const WRAPPING: bool>(&self, n: usize) -> (*const T, *const T); fn split_mut_ptr<const WRAPPING: bool>( &mut self, n: usize ) -> (*mut T, *mut T); fn rsplit_ptr<const WRAPPING: bool>(&self, n: usize) -> (*const T, *const T); fn rsplit_mut_ptr<const WRAPPING: bool>( &mut self, n: usize ) -> (*mut T, *mut T); fn fill<F>(fill: F) -> Self where F: FnMut(usize) -> T; fn rfill<F>(fill: F) -> Self where F: FnMut(usize) -> T; fn for_each<F>(self, action: F) where F: FnMut(T); fn for_each_ref<F>(&self, action: F) where F: FnMut(&T); fn for_each_mut<F>(&mut self, action: F) where F: FnMut(&mut T); fn truncate<const M: usize>(self) -> Self::Resized<M>; fn rtruncate<const M: usize>(self) -> Self::Resized<M>; fn resize<const M: usize, F>(self, fill: F) -> Self::Resized<M> where F: FnMut(usize) -> T; fn rresize<const M: usize, F>(self, fill: F) -> Self::Resized<M> where F: FnMut(usize) -> T; fn extend<const M: usize, F>(self, fill: F) -> Self::Resized<M> where F: FnMut(usize) -> T; fn rextend<const M: usize, F>(self, fill: F) -> Self::Resized<M> where F: FnMut(usize) -> T; fn reformulate_length<const M: usize>(self) -> Self::Resized<M>; fn reformulate_length_ref<const M: usize>(&self) -> &Self::Resized<M>; fn reformulate_length_mut<const M: usize>( &mut self ) -> &mut Self::Resized<M>; fn try_reformulate_length<const M: usize>( self ) -> Result<Self::Resized<M>, Self>; fn try_reformulate_length_ref<const M: usize>( &self ) -> Option<&Self::Resized<M>>; fn try_reformulate_length_mut<const M: usize>( &mut self ) -> Option<&mut Self::Resized<M>>; fn into_const_iter(self) -> IntoConstIter<T, N, true>; fn into_const_iter_reverse(self) -> IntoConstIter<T, N, false>; fn const_iter(&self) -> ConstIter<'_, T, N>; fn const_iter_mut(&mut self) -> ConstIterMut<'_, T, N>; fn map2<Map>(self, map: Map) -> Self::Mapped<Map> where Map: FnMut(T); fn map_outer<Map>( &self, map: Map ) -> Self::MappedTo<Self::MappedTo<<Map as FnOnce(T, T)>::Output>> where Map: FnMut(T, T), T: Copy; fn comap<Map, Rhs>( self, rhs: [Rhs; N], map: Map ) -> Self::MappedTo<<Map as FnOnce(T, Rhs)>::Output> where Map: FnMut(T, Rhs); fn comap_outer<Map, Rhs, const M: usize>( &self, rhs: &Self::Array<Rhs, M>, map: Map ) -> Self::MappedTo<Self::Array<<Map as FnOnce(T, Rhs)>::Output, M>> where Map: FnMut(T, Rhs), T: Copy, Rhs: Copy; fn zip2<Z>(self, other: Self::Array<Z, N>) -> Self::Zipped<Z>; fn zip_outer<Z, const M: usize>( &self, other: &Self::Array<Z, M> ) -> Self::MappedTo<Self::Array<(T, Z), M>> where T: Copy, Z: Copy; fn enumerate(self) -> Self::Enumerated; fn diagonal<const H: usize, const W: usize>( self ) -> Self::Array<Self::Resized<W>, H> where T: Default + Copy; fn differentiate(self) -> Self::Differentiated where T: Sub + Copy; fn integrate(self) -> Self where T: AddAssign + Copy; fn integrate_from<const M: usize>(self, x0: T) -> Self::Resized<M> where T: AddAssign + Copy; fn reduce<R>(self, reduce: R) -> Option<T> where R: FnMut(T, T) -> T; fn try_sum(self) -> Option<T> where T: AddAssign; fn sum_from<S>(self, from: S) -> S where S: AddAssign<T>; fn try_product(self) -> Option<T> where T: MulAssign; fn product_from<P>(self, from: P) -> P where P: MulAssign<T>; fn max(self) -> Option<T> where T: Ord; fn min(self) -> Option<T> where T: Ord; fn first_max(self) -> Option<T> where T: PartialOrd; fn first_min(self) -> Option<T> where T: PartialOrd; fn argmax(self) -> Option<usize> where T: PartialOrd; fn argmin(self) -> Option<usize> where T: PartialOrd; fn all(&self) -> bool where T: Into<bool> + Copy; fn any(&self) -> bool where T: Into<bool> + Copy; fn eq2<Rhs>(&self, rhs: &[Rhs]) -> bool where T: PartialEq<Rhs>; fn add_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Add<Rhs>>::Output> where T: Add<Rhs>, Rhs: Copy; fn sub_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Sub<Rhs>>::Output> where T: Sub<Rhs>, Rhs: Copy; fn mul_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Mul<Rhs>>::Output> where T: Mul<Rhs>, Rhs: Copy; fn div_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Div<Rhs>>::Output> where T: Div<Rhs>, Rhs: Copy; fn add_all_neg<Rhs>( self, rhs: Rhs ) -> Self::MappedTo<<Rhs as Sub<T>>::Output> where Rhs: Copy + Sub<T>; fn mul_all_inv<Rhs>( self, rhs: Rhs ) -> Self::MappedTo<<Rhs as Div<T>>::Output> where Rhs: Copy + Div<T>; fn neg_all(self) -> [<T as Neg>::Output; N] where T: Neg; fn add_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Add<Rhs>>::Output> where T: Add<Rhs>; fn sub_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Sub<Rhs>>::Output> where T: Sub<Rhs>; fn mul_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Mul<Rhs>>::Output> where T: Mul<Rhs>; fn div_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Div<Rhs>>::Output> where T: Div<Rhs>; fn try_mul_dot<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Option<<T as Mul<Rhs>>::Output> where T: Mul<Rhs>, <T as Mul<Rhs>>::Output: AddAssign; fn mul_dot_bias<Rhs>( self, rhs: Self::MappedTo<Rhs>, bias: <T as Mul<Rhs>>::Output ) -> <T as Mul<Rhs>>::Output where T: Mul<Rhs>, <T as Mul<Rhs>>::Output: AddAssign; fn mul_outer<Rhs, const M: usize>( &self, rhs: &Self::Array<Rhs, M> ) -> Self::MappedTo<Self::Array<<T as Mul<Rhs>>::Output, M>> where T: Mul<Rhs> + Copy, Rhs: Copy; fn mul_cross<Rhs>( &self, rhs: [&Self::MappedTo<Rhs>; { _ }] ) -> Self::MappedTo<<T as Sub>::Output> where T: MulAssign<Rhs> + Sub + Copy, Rhs: Copy; fn try_magnitude_squared(self) -> Option<<T as Mul>::Output> where T: Mul + Copy, <T as Mul>::Output: AddAssign; fn chain<const M: usize>( self, rhs: Self::Array<T, M> ) -> Self::Resized<array_trait::::array_ops::ArrayOps::chain::{constant#0}>; fn rchain<const M: usize>( self, rhs: Self::Array<T, M> ) -> Self::Resized<array_trait::::array_ops::ArrayOps::rchain::{constant#0}>; fn into_rotate_left(self, n: usize) -> Self; fn into_rotate_right(self, n: usize) -> Self; fn into_shift_many_left<const M: usize>( self, items: [T; M] ) -> ([T; M], Self); fn into_shift_many_right<const M: usize>( self, items: [T; M] ) -> (Self, [T; M]); fn into_shift_left(self, item: T) -> (T, Self); fn into_shift_right(self, item: T) -> (Self, T); fn rotate_left2(&mut self, n: usize); fn rotate_right2(&mut self, n: usize); fn shift_many_left<const M: usize>(&mut self, items: [T; M]) -> [T; M]; fn shift_many_right<const M: usize>(&mut self, items: [T; M]) -> [T; M]; fn shift_left(&mut self, item: T) -> T; fn shift_right(&mut self, item: T) -> T; fn from_item(item: T) -> Self::Array<T, 1>; fn from_item_ref(item: &T) -> &Self::Array<T, 1>; fn from_item_mut(item: &mut T) -> &mut Self::Array<T, 1>; fn into_single_item(self) -> T; fn try_into_single_item(self) -> Result<T, Self>; fn array_spread<const M: usize>( self ) -> ([Self::ResizedDiv<M>; M], Self::ResizedRem<M>); fn array_spread_ref<const M: usize>( &self ) -> ([&Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_ref::{constant#2}>; M], &Self::ResizedRem<M>); fn array_spread_mut<const M: usize>( &mut self ) -> ([&mut Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_mut::{constant#2}>; M], &mut Self::ResizedRem<M>); fn array_rspread<const M: usize>( self ) -> (Self::ResizedRem<M>, [Self::ResizedDiv<M>; M]) where T: Copy; fn array_rspread_ref<const M: usize>( &self ) -> (&Self::ResizedRem<M>, [&Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_rspread_ref::{constant#2}>; M]); fn array_rspread_mut<const M: usize>( &mut self ) -> (&mut Self::ResizedRem<M>, [&mut Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_rspread_mut::{constant#2}>; M]); fn array_spread_exact<const M: usize>(self) -> [Self::ResizedDiv<M>; M]; fn array_spread_exact_ref<const M: usize>( &self ) -> [&Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_exact_ref::{constant#2}>; M]; fn array_spread_exact_mut<const M: usize>( &mut self ) -> [&mut Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_exact_mut::{constant#2}>; M]; fn array_chunks<const M: usize>( self ) -> (Self::Chunks<M>, Self::ResizedRem<M>); fn array_chunks_ref<const M: usize>( &self ) -> (&Self::Chunks<M>, &Self::ResizedRem<M>); fn array_chunks_mut<const M: usize>( &mut self ) -> (&mut Self::Chunks<M>, &mut Self::ResizedRem<M>); fn array_rchunks<const M: usize>( self ) -> (Self::ResizedRem<M>, Self::Chunks<M>); fn array_rchunks_ref<const M: usize>( &self ) -> (&Self::ResizedRem<M>, &Self::Chunks<M>); fn array_rchunks_mut<const M: usize>( &mut self ) -> (&mut Self::ResizedRem<M>, &mut Self::Chunks<M>); fn array_chunks_exact<const M: usize>(self) -> Self::Chunks<M>; fn array_chunks_exact_ref<const M: usize>(&self) -> &Self::Chunks<M>; fn array_chunks_exact_mut<const M: usize>(&mut self) -> &mut Self::Chunks<M>; fn split_array<const M: usize>( self ) -> (Self::Resized<M>, Self::Resized<array_trait::::array_ops::ArrayOps::split_array::{constant#1}>); fn split_array_ref2<const M: usize>( &self ) -> (&Self::Resized<M>, &Self::Resized<array_trait::::array_ops::ArrayOps::split_array_ref2::{constant#1}>); fn split_array_mut2<const M: usize>( &mut self ) -> (&mut Self::Resized<M>, &mut Self::Resized<array_trait::::array_ops::ArrayOps::split_array_mut2::{constant#1}>); fn rsplit_array<const M: usize>( self ) -> (Self::Resized<array_trait::::array_ops::ArrayOps::rsplit_array::{constant#1}>, Self::Resized<M>); fn rsplit_array_ref2<const M: usize>( &self ) -> (&Self::Resized<array_trait::::array_ops::ArrayOps::rsplit_array_ref2::{constant#1}>, &Self::Resized<M>); fn rsplit_array_mut2<const M: usize>( &mut self ) -> (&mut Self::Resized<array_trait::::array_ops::ArrayOps::rsplit_array_mut2::{constant#1}>, &mut Self::Resized<M>); fn each_ref2<B>(&self) -> Self::MappedTo<&B> where T: Borrow<B>; fn each_mut2<B>(&mut self) -> Self::MappedTo<&mut B> where T: BorrowMut<B>;
}

Provided Associated Types§

source

type Array<I, const L: usize>: ArrayOps<I, L> = [I; L]

source

type PaddedItem<I, const W: usize>: Borrow<I> + BorrowMut<I> = Padded<I, W>

source

type PaddedArray<I, const W: usize, const L: usize>: ArrayOps<Self::PaddedItem<I, W>, L> = Self::Array<Self::PaddedItem<I, W>, L>

source

type Resized<const M: usize>: ArrayOps<T, M> = Self::Array<T, M>

source

type Chained<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::Chained::{constant#1}> = Self::Array<T, array_trait::::array_ops::ArrayOps::Chained::{constant#2}>

source

type RChained<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::RChained::{constant#1}> = Self::Array<T, array_trait::::array_ops::ArrayOps::RChained::{constant#2}>

source

type MappedTo<M>: ArrayOps<M, N> = Self::Array<M, N>

source

type Mapped<M: FnOnce(T)>: ArrayOps<<M as FnOnce(T)>::Output, N> = Self::MappedTo<<M as FnOnce(T)>::Output>

source

type Zipped<Z>: ArrayOps<(T, Z), N> = Self::MappedTo<(T, Z)>

source

type Enumerated: ArrayOps<(usize, T), N> = Self::MappedTo<usize>::Zipped<T>

source

type Differentiated: ArrayOps<<T as Sub>::Output, array_trait::::array_ops::ArrayOps::Differentiated::{constant#1}> = Self::Array<<T as Sub>::Output, array_trait::::array_ops::ArrayOps::Differentiated::{constant#2}> where T: Sub

source

type Split<const M: usize>: ArrayOps<T, M> = Self::Resized<M>

source

type RSplit<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::RSplit::{constant#1}> = Self::Resized<array_trait::::array_ops::ArrayOps::RSplit::{constant#2}>

source

type ResizedDiv<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::ResizedDiv::{constant#1}> = Self::Resized<array_trait::::array_ops::ArrayOps::ResizedDiv::{constant#2}>

source

type ResizedRem<const M: usize>: ArrayOps<T, array_trait::::array_ops::ArrayOps::ResizedRem::{constant#1}> = Self::Resized<array_trait::::array_ops::ArrayOps::ResizedRem::{constant#2}>

source

type Chunks<const M: usize>: ArrayOps<Self::Array<T, M>, array_trait::::array_ops::ArrayOps::Chunks::{constant#1}> = [Self::Array<T, M>; { _ }]

Required Methods§

source

fn split_len<const WRAPPING: bool>(n: usize) -> (usize, usize)

source

fn rsplit_len<const WRAPPING: bool>(n: usize) -> (usize, usize)

source

fn split_ptr<const WRAPPING: bool>(&self, n: usize) -> (*const T, *const T)

source

fn split_mut_ptr<const WRAPPING: bool>(&mut self, n: usize) -> (*mut T, *mut T)

source

fn rsplit_ptr<const WRAPPING: bool>(&self, n: usize) -> (*const T, *const T)

source

fn rsplit_mut_ptr<const WRAPPING: bool>(&mut self, n: usize) -> (*mut T, *mut T)

source

fn fill<F>(fill: F) -> Self
where F: FnMut(usize) -> T,

source

fn rfill<F>(fill: F) -> Self
where F: FnMut(usize) -> T,

source

fn for_each<F>(self, action: F)
where F: FnMut(T),

source

fn for_each_ref<F>(&self, action: F)
where F: FnMut(&T),

source

fn for_each_mut<F>(&mut self, action: F)
where F: FnMut(&mut T),

source

fn truncate<const M: usize>(self) -> Self::Resized<M>

source

fn rtruncate<const M: usize>(self) -> Self::Resized<M>

source

fn resize<const M: usize, F>(self, fill: F) -> Self::Resized<M>
where F: FnMut(usize) -> T,

source

fn rresize<const M: usize, F>(self, fill: F) -> Self::Resized<M>
where F: FnMut(usize) -> T,

source

fn extend<const M: usize, F>(self, fill: F) -> Self::Resized<M>
where F: FnMut(usize) -> T,

source

fn rextend<const M: usize, F>(self, fill: F) -> Self::Resized<M>
where F: FnMut(usize) -> T,

source

fn reformulate_length<const M: usize>(self) -> Self::Resized<M>

source

fn reformulate_length_ref<const M: usize>(&self) -> &Self::Resized<M>

source

fn reformulate_length_mut<const M: usize>(&mut self) -> &mut Self::Resized<M>

source

fn try_reformulate_length<const M: usize>( self ) -> Result<Self::Resized<M>, Self>

source

fn try_reformulate_length_ref<const M: usize>( &self ) -> Option<&Self::Resized<M>>

source

fn try_reformulate_length_mut<const M: usize>( &mut self ) -> Option<&mut Self::Resized<M>>

source

fn into_const_iter(self) -> IntoConstIter<T, N, true>

Converts an array into a const interator.

The const iterator does not implement std::iter::Iterator, and as such is more limited in its usage. However it can be used at compile-time.

Example
#![feature(inline_const)]
#![feature(const_trait_impl)]
#![feature(const_mut_refs)]
#![feature(const_deref)]
 
use core::{mem::ManuallyDrop, ops::DerefMut};
use array_trait::*;
 
const A: [u8; 3] = [1, 2, 3];
 
const A_SUM: u8 = const {
    let mut iter = ManuallyDrop::new(A.into_const_iter());
    let mut sum = 0;
 
    while let Some(b) = iter.deref_mut().next()
    {
        sum += b;
    }
 
    sum
};
 
assert_eq!(A_SUM, 1 + 2 + 3);
source

fn into_const_iter_reverse(self) -> IntoConstIter<T, N, false>

source

fn const_iter(&self) -> ConstIter<'_, T, N>

Makes a const iterator over the array-slice.

The const iterator does not implement std::iter::Iterator, and as such is more limited in its usage. However it can be used at compile-time.

source

fn const_iter_mut(&mut self) -> ConstIterMut<'_, T, N>

Makes a mutable const iterator over the mutable array-slice.

The const iterator does not implement std::iter::Iterator, and as such is more limited in its usage. However it can be used at compile-time.

source

fn map2<Map>(self, map: Map) -> Self::Mapped<Map>
where Map: FnMut(T),

Maps all values of an array with a given function.

This method can be executed at compile-time, as opposed to the standard-library method.

Example
#![feature(const_closures)]
#![feature(const_mut_refs)]
#![feature(const_trait_impl)]
 
use array_trait::*;
 
const A: [u8; 4] = [1, 2, 3, 4];
const B: [i8; 4] = A.map2(/*const*/ |b| -(b as i8));
 
assert_eq!(B, [-1, -2, -3, -4]);
source

fn map_outer<Map>( &self, map: Map ) -> Self::MappedTo<Self::MappedTo<<Map as FnOnce(T, T)>::Output>>
where Map: FnMut(T, T), T: Copy,

source

fn comap<Map, Rhs>( self, rhs: [Rhs; N], map: Map ) -> Self::MappedTo<<Map as FnOnce(T, Rhs)>::Output>
where Map: FnMut(T, Rhs),

source

fn comap_outer<Map, Rhs, const M: usize>( &self, rhs: &Self::Array<Rhs, M>, map: Map ) -> Self::MappedTo<Self::Array<<Map as FnOnce(T, Rhs)>::Output, M>>
where Map: FnMut(T, Rhs), T: Copy, Rhs: Copy,

source

fn zip2<Z>(self, other: Self::Array<Z, N>) -> Self::Zipped<Z>

Combines two arrays with possibly different items into parallel, where each element lines up in the same position.

This method can be executed at compile-time, as opposed to the standard-library method.

Example
#![feature(const_trait_impl)]
 
use array_trait::*;
 
const A: [u8; 4] = [4, 3, 2, 1];
const B: [&str; 4] = ["four", "three", "two", "one"];
const C: [(u8, &str); 4] = A.zip2(B);
 
assert_eq!(C, [(4, "four"), (3, "three"), (2, "two"), (1, "one")]);
source

fn zip_outer<Z, const M: usize>( &self, other: &Self::Array<Z, M> ) -> Self::MappedTo<Self::Array<(T, Z), M>>
where T: Copy, Z: Copy,

source

fn enumerate(self) -> Self::Enumerated

source

fn diagonal<const H: usize, const W: usize>( self ) -> Self::Array<Self::Resized<W>, H>
where T: Default + Copy,

source

fn differentiate(self) -> Self::Differentiated
where T: Sub + Copy,

Differentiates array (discrete calculus)

Example
#![feature(generic_const_exprs)]
 
use array_trait::*;
 
let a = [1, 2, 3];
 
assert_eq!(a.differentiate(), [2 - 1, 3 - 2]);
source

fn integrate(self) -> Self
where T: AddAssign + Copy,

Integrates array (discrete calculus)

Example
use array_trait::*;
 
let a = [1, 2, 3];
 
assert_eq!(a.integrate(), [1, 1 + 2, 1 + 2 + 3])
source

fn integrate_from<const M: usize>(self, x0: T) -> Self::Resized<M>
where T: AddAssign + Copy,

source

fn reduce<R>(self, reduce: R) -> Option<T>
where R: FnMut(T, T) -> T,

Reduces elements in array into one element, using a given operand

Example
#![feature(generic_const_exprs)]
 
use array_trait::ArrayOps;
 
const A: [u8; 3] = [1, 2, 3];
 
let r: u8 = A.reduce(|a, b| a + b).unwrap();
 
assert_eq!(r, 6);
source

fn try_sum(self) -> Option<T>
where T: AddAssign,

source

fn sum_from<S>(self, from: S) -> S
where S: AddAssign<T>,

source

fn try_product(self) -> Option<T>
where T: MulAssign,

source

fn product_from<P>(self, from: P) -> P
where P: MulAssign<T>,

source

fn max(self) -> Option<T>
where T: Ord,

source

fn min(self) -> Option<T>
where T: Ord,

source

fn first_max(self) -> Option<T>
where T: PartialOrd,

source

fn first_min(self) -> Option<T>
where T: PartialOrd,

source

fn argmax(self) -> Option<usize>
where T: PartialOrd,

source

fn argmin(self) -> Option<usize>
where T: PartialOrd,

source

fn all(&self) -> bool
where T: Into<bool> + Copy,

source

fn any(&self) -> bool
where T: Into<bool> + Copy,

source

fn eq2<Rhs>(&self, rhs: &[Rhs]) -> bool
where T: PartialEq<Rhs>,

source

fn add_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Add<Rhs>>::Output>
where T: Add<Rhs>, Rhs: Copy,

source

fn sub_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Sub<Rhs>>::Output>
where T: Sub<Rhs>, Rhs: Copy,

source

fn mul_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Mul<Rhs>>::Output>
where T: Mul<Rhs>, Rhs: Copy,

source

fn div_all<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<T as Div<Rhs>>::Output>
where T: Div<Rhs>, Rhs: Copy,

source

fn add_all_neg<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<Rhs as Sub<T>>::Output>
where Rhs: Copy + Sub<T>,

source

fn mul_all_inv<Rhs>(self, rhs: Rhs) -> Self::MappedTo<<Rhs as Div<T>>::Output>
where Rhs: Copy + Div<T>,

source

fn neg_all(self) -> [<T as Neg>::Output; N]
where T: Neg,

source

fn add_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Add<Rhs>>::Output>
where T: Add<Rhs>,

source

fn sub_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Sub<Rhs>>::Output>
where T: Sub<Rhs>,

source

fn mul_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Mul<Rhs>>::Output>
where T: Mul<Rhs>,

source

fn div_each<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Self::MappedTo<<T as Div<Rhs>>::Output>
where T: Div<Rhs>,

source

fn try_mul_dot<Rhs>( self, rhs: Self::MappedTo<Rhs> ) -> Option<<T as Mul<Rhs>>::Output>
where T: Mul<Rhs>, <T as Mul<Rhs>>::Output: AddAssign,

source

fn mul_dot_bias<Rhs>( self, rhs: Self::MappedTo<Rhs>, bias: <T as Mul<Rhs>>::Output ) -> <T as Mul<Rhs>>::Output
where T: Mul<Rhs>, <T as Mul<Rhs>>::Output: AddAssign,

source

fn mul_outer<Rhs, const M: usize>( &self, rhs: &Self::Array<Rhs, M> ) -> Self::MappedTo<Self::Array<<T as Mul<Rhs>>::Output, M>>
where T: Mul<Rhs> + Copy, Rhs: Copy,

source

fn mul_cross<Rhs>( &self, rhs: [&Self::MappedTo<Rhs>; { _ }] ) -> Self::MappedTo<<T as Sub>::Output>
where T: MulAssign<Rhs> + Sub + Copy, Rhs: Copy,

Computes the general cross-product of the two arrays (as if vectors, in the mathematical sense).

Example
#![feature(generic_const_exprs)]
#![feature(const_trait_impl)]
 
use array_trait::ArrayOps;
 
const U: [f64; 3] = [1.0, 0.0, 0.0];
const V: [f64; 3] = [0.0, 1.0, 0.0];
 
const W: [f64; 3] = U.mul_cross([&V]);
 
assert_eq!(W, [0.0, 0.0, 1.0]);
source

fn try_magnitude_squared(self) -> Option<<T as Mul>::Output>
where T: Mul + Copy, <T as Mul>::Output: AddAssign,

source

fn chain<const M: usize>( self, rhs: Self::Array<T, M> ) -> Self::Resized<array_trait::::array_ops::ArrayOps::chain::{constant#0}>

Chains two arrays with the same item together.

Example
use array_trait::*;
 
let a = ["one", "two"];
let b = ["three"];
 
assert_eq!(a.chain(b), ["one", "two", "three"]);
source

fn rchain<const M: usize>( self, rhs: Self::Array<T, M> ) -> Self::Resized<array_trait::::array_ops::ArrayOps::rchain::{constant#0}>

Chains two arrays with the same item together in reverse.

Example
use array_trait::*;
 
let a = ["two", "three"];
let b = ["one"];
 
assert_eq!(a.rchain(b), ["one", "two", "three"]);
source

fn into_rotate_left(self, n: usize) -> Self

source

fn into_rotate_right(self, n: usize) -> Self

source

fn into_shift_many_left<const M: usize>(self, items: [T; M]) -> ([T; M], Self)

source

fn into_shift_many_right<const M: usize>(self, items: [T; M]) -> (Self, [T; M])

source

fn into_shift_left(self, item: T) -> (T, Self)

source

fn into_shift_right(self, item: T) -> (Self, T)

source

fn rotate_left2(&mut self, n: usize)

source

fn rotate_right2(&mut self, n: usize)

source

fn shift_many_left<const M: usize>(&mut self, items: [T; M]) -> [T; M]

source

fn shift_many_right<const M: usize>(&mut self, items: [T; M]) -> [T; M]

source

fn shift_left(&mut self, item: T) -> T

source

fn shift_right(&mut self, item: T) -> T

source

fn from_item(item: T) -> Self::Array<T, 1>

source

fn from_item_ref(item: &T) -> &Self::Array<T, 1>

source

fn from_item_mut(item: &mut T) -> &mut Self::Array<T, 1>

source

fn into_single_item(self) -> T

source

fn try_into_single_item(self) -> Result<T, Self>

source

fn array_spread<const M: usize>( self ) -> ([Self::ResizedDiv<M>; M], Self::ResizedRem<M>)

Distributes items of an array equally across a given width, then provides the rest as a separate array.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let array = ["ping 1", "pong 1", "ping 2", "pong 2", "ping 3", "pong 3", "uhh..."];
 
let ([ping, pong], rest) = array.array_spread::<2>();
 
assert_eq!(ping, ["ping 1", "ping 2", "ping 3"]);
assert_eq!(pong, ["pong 1", "pong 2", "pong 3"]);
assert_eq!(rest, ["uhh..."]);
source

fn array_spread_ref<const M: usize>( &self ) -> ([&Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_ref::{constant#2}>; M], &Self::ResizedRem<M>)

Distributes items of an array-slice equally across a given width, then provides the rest as a separate array-slice.

The spread-out slices are given in padded arrays. Each padded item can be borrowed into a reference to the array’s item.

source

fn array_spread_mut<const M: usize>( &mut self ) -> ([&mut Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_mut::{constant#2}>; M], &mut Self::ResizedRem<M>)

Distributes items of a mutable array-slice equally across a given width, then provides the rest as a separate mutable array-slice.

The spread-out slices are given in padded arrays. Each padded item can be borrowed into a reference to the array’s item.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let mut array = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"];
 
let (threes, _) = array.array_spread_mut::<3>();
 
for fizz in threes.into_iter().last().unwrap()
{
    **fizz = "fizz";
}
 
let (fives, _) = array.array_spread_mut::<5>();
 
for buzz in fives.into_iter().last().unwrap()
{
    **buzz = "buzz";
}
 
let (fifteens, _) = array.array_spread_mut::<15>();
 
for fizzbuzz in fifteens.into_iter().last().unwrap()
{
    **fizzbuzz = "fizzbuzz";
}
 
assert_eq!(array, ["1", "2", "fizz", "4", "buzz", "fizz", "7", "8", "fizz", "buzz", "11", "fizz", "13", "14", "fizzbuzz", "16", "17", "fizz", "19", "buzz"]);
 
source

fn array_rspread<const M: usize>( self ) -> (Self::ResizedRem<M>, [Self::ResizedDiv<M>; M])
where T: Copy,

Distributes items of an array equally across a given width, then provides the leftmost rest as a separate array.

source

fn array_rspread_ref<const M: usize>( &self ) -> (&Self::ResizedRem<M>, [&Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_rspread_ref::{constant#2}>; M])

Distributes items of an array-slice equally across a given width, then provides the leftmost rest as a separate array-slice.

The spread-out slices are given in padded arrays. Each padded item can be borrowed into a reference to the array’s item.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
#![feature(array_methods)]
 
use array_trait::*;
 
let array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
 
let (zero, [odd, even]) = array.array_rspread_ref::<2>();
 
assert_eq!(*zero, [0]);
assert_eq!(odd.each_ref().map(|padding| **padding), [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]);
assert_eq!(even.each_ref().map(|padding| **padding), [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]);
source

fn array_rspread_mut<const M: usize>( &mut self ) -> (&mut Self::ResizedRem<M>, [&mut Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_rspread_mut::{constant#2}>; M])

Distributes items of a mutable array-slice equally across a given width, then provides the leftmost rest as a separate mutable array-slice.

The spread-out slices are given in padded arrays. Each padded item can be borrowed into a reference to the array’s item.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
#![feature(array_methods)]
 
use array_trait::*;
 
let mut array = ["the", "beat", "goes", "1", "2", "3", "4", "5", "6", "7", "8"];
 
let (start, [boots, n, cats, and]) = array.array_rspread_mut::<4>();
 
for boots in boots
{
    **boots = "boots";
}
for n in n
{
    **n = "n";
}
for cats in cats
{
    **cats = "cats";
}
for and in and
{
    **and = "and";
}
 
assert_eq!(array, ["the", "beat", "goes", "boots", "n", "cats", "and", "boots", "n", "cats", "and"]);
source

fn array_spread_exact<const M: usize>(self) -> [Self::ResizedDiv<M>; M]

Distributes items of an array equally across a given width, with no rest.

The width must be a factor of the array length, otherwise it will not compile.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let array = *b"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
 
let [lower_case, upper_case] = array.array_spread_exact::<2>();
 
assert_eq!(lower_case, *b"abcdefghijklmnopqrstuvwxyz");
assert_eq!(upper_case, *b"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
source

fn array_spread_exact_ref<const M: usize>( &self ) -> [&Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_exact_ref::{constant#2}>; M]

Distributes items of an array-slice equally across a given width, with no rest.

The width must be a factor of the array length, otherwise it will not compile.

The spread-out slices are given in padded arrays. Each padded item can be borrowed into a reference to the array’s item.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
#![feature(array_methods)]
 
use array_trait::*;
 
let statement = ["s", "he", "be", "lie", "ve", "d"];
 
let [interpretation2, interpretation1] = statement.array_spread_exact_ref::<2>();
 
assert_eq!(interpretation1.each_ref().map(|padding| &**padding), ["he", "lie", "d"].each_ref());
assert_eq!(interpretation2.each_ref().map(|padding| &**padding), ["s", "be", "ve"].each_ref());
source

fn array_spread_exact_mut<const M: usize>( &mut self ) -> [&mut Self::PaddedArray<T, M, array_trait::::array_ops::ArrayOps::array_spread_exact_mut::{constant#2}>; M]

Distributes items of a mutable array-slice equally across a given width, with no rest.

The width must be a factor of the array length, otherwise it will not compile.

The spread-out slices are given in padded arrays. Each padded item can be borrowed into a reference to the array’s item.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
#![feature(array_methods)]
 
use array_trait::*;
 
let mut array = *b"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
 
let [lower_case, upper_case] = array.array_spread_exact_mut::<2>();
 
assert_eq!(lower_case.each_ref().map(|padding| padding.borrow()), b"abcdefghijklmnopqrstuvwxyz".each_ref());
assert_eq!(upper_case.each_ref().map(|padding| padding.borrow()), b"ABCDEFGHIJKLMNOPQRSTUVWXYZ".each_ref());
 
for c in upper_case
{
    **c = b'_';
}
 
assert_eq!(array, *b"a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z_")
source

fn array_chunks<const M: usize>(self) -> (Self::Chunks<M>, Self::ResizedRem<M>)

Divides an array into chunks, then yielding the rest in a separate array.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let array = ["carrot", "potato", "beet", "tomato", "kiwi", "banana", "cherry", "peach", "strawberry", "nine volt batteries"];
 
let ([root_vegetables, technically_berries, stone_fruits], not_for_human_consumption) = array.array_chunks::<3>();
 
assert_eq!(root_vegetables, ["carrot", "potato", "beet"]);
assert_eq!(technically_berries, ["tomato", "kiwi", "banana"]);
assert_eq!(stone_fruits, ["cherry", "peach", "strawberry"]);
assert_eq!(not_for_human_consumption, ["nine volt batteries"]);
source

fn array_chunks_ref<const M: usize>( &self ) -> (&Self::Chunks<M>, &Self::ResizedRem<M>)

Divides an array-slice into chunks, then yielding the rest in a separate array-slice.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let transistors = ["2N3904", "2N2222A", "BC107", "AC127", "OC7", "NKT275", "2SK30A", "2N5458", "J108", "2N7000", "BS170"];
 
let ([silicon_bjts, germanium_bjts, jfets], mosfets) = transistors.array_chunks_ref::<3>();
 
assert_eq!(silicon_bjts, &["2N3904", "2N2222A", "BC107"]);
assert_eq!(germanium_bjts, &["AC127", "OC7", "NKT275"]);
assert_eq!(jfets, &["2SK30A", "2N5458", "J108"]);
assert_eq!(mosfets, &["2N7000", "BS170"]);
source

fn array_chunks_mut<const M: usize>( &mut self ) -> (&mut Self::Chunks<M>, &mut Self::ResizedRem<M>)

Divides a mutable array-slice into chunks, then yielding the rest in a separate mutable array-slice.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let mut array = [0, 1, 0, 1, 0, 1, 6];
 
let (pairs, last) = array.array_chunks_mut::<2>();
 
for (i, pair) in pairs.into_iter().enumerate()
{
    for number in pair
    {
        *number += i*2;
    }
}
 
assert_eq!(array, [0, 1, 2, 3, 4, 5, 6]);
source

fn array_rchunks<const M: usize>(self) -> (Self::ResizedRem<M>, Self::Chunks<M>)

Divides a mutable array-slice into chunks, then yielding the leftmost rest in a separate mutable array-slice.

source

fn array_rchunks_ref<const M: usize>( &self ) -> (&Self::ResizedRem<M>, &Self::Chunks<M>)

Divides an array-slice into chunks, then yielding the leftmost rest in a separate array-slice.

source

fn array_rchunks_mut<const M: usize>( &mut self ) -> (&mut Self::ResizedRem<M>, &mut Self::Chunks<M>)

Divides a mutable array-slice into chunks, then yielding the leftmost rest in a separate array-slice.

source

fn array_chunks_exact<const M: usize>(self) -> Self::Chunks<M>

Divides an array into chunks, with no rest.

The chunk length must be a factor of the array length, otherwise it will not compile.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let array = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];
 
let [lower_half, upper_half] = array.array_chunks_exact::<5>();
 
assert_eq!(lower_half, [0.0, 0.1, 0.2, 0.3, 0.4]);
assert_eq!(upper_half, [0.5, 0.6, 0.7, 0.8, 0.9]);
source

fn array_chunks_exact_ref<const M: usize>(&self) -> &Self::Chunks<M>

Divides an array-slice into chunks, with no rest.

The chunk length must be a factor of the array length, otherwise it will not compile.

Example
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
 
use array_trait::*;
 
let array = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];
 
let [lower_half, upper_half] = array.array_chunks_exact_ref::<5>();
 
assert_eq!(lower_half, &[0.0, 0.1, 0.2, 0.3, 0.4]);
assert_eq!(upper_half, &[0.5, 0.6, 0.7, 0.8, 0.9]);
source

fn array_chunks_exact_mut<const M: usize>(&mut self) -> &mut Self::Chunks<M>

Divides a mutable array-slice into chunks, with no rest.

The chunk length must be a factor of the array length, otherwise it will not compile.

source

fn split_array<const M: usize>( self ) -> (Self::Resized<M>, Self::Resized<array_trait::::array_ops::ArrayOps::split_array::{constant#1}>)

Splits an array at a chosen index.

source

fn split_array_ref2<const M: usize>( &self ) -> (&Self::Resized<M>, &Self::Resized<array_trait::::array_ops::ArrayOps::split_array_ref2::{constant#1}>)

Splits an array at a chosen index as array-slices.

source

fn split_array_mut2<const M: usize>( &mut self ) -> (&mut Self::Resized<M>, &mut Self::Resized<array_trait::::array_ops::ArrayOps::split_array_mut2::{constant#1}>)

Splits an array at a chosen index as mutable array-slices.

source

fn rsplit_array<const M: usize>( self ) -> (Self::Resized<array_trait::::array_ops::ArrayOps::rsplit_array::{constant#1}>, Self::Resized<M>)

Splits an array at a chosen index, where the index goes from right to left.

source

fn rsplit_array_ref2<const M: usize>( &self ) -> (&Self::Resized<array_trait::::array_ops::ArrayOps::rsplit_array_ref2::{constant#1}>, &Self::Resized<M>)

Splits an array at a chosen index as array-slices, where the index goes from right to left.

source

fn rsplit_array_mut2<const M: usize>( &mut self ) -> (&mut Self::Resized<array_trait::::array_ops::ArrayOps::rsplit_array_mut2::{constant#1}>, &mut Self::Resized<M>)

Splits an array at a chosen index as mutable array-slices, where the index goes from right to left.

source

fn each_ref2<B>(&self) -> Self::MappedTo<&B>
where T: Borrow<B>,

source

fn each_mut2<B>(&mut self) -> Self::MappedTo<&mut B>
where T: BorrowMut<B>,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, const N: usize> ArrayOps<T, N> for [T; N]

§

type Array<I, const M: usize> = [I; M]

source§

fn split_len<const WRAPPING: bool>(n: usize) -> (usize, usize)

source§

fn rsplit_len<const WRAPPING: bool>(n: usize) -> (usize, usize)

source§

fn split_ptr<const WRAPPING: bool>(&self, n: usize) -> (*const T, *const T)

source§

fn split_mut_ptr<const WRAPPING: bool>(&mut self, n: usize) -> (*mut T, *mut T)

source§

fn rsplit_ptr<const WRAPPING: bool>(&self, n: usize) -> (*const T, *const T)

source§

fn rsplit_mut_ptr<const WRAPPING: bool>(&mut self, n: usize) -> (*mut T, *mut T)

source§

fn fill<F>(fill: F) -> [T; N]
where F: FnMut(usize) -> T,

source§

fn rfill<F>(fill: F) -> [T; N]
where F: FnMut(usize) -> T,

source§

fn for_each<F>(self, action: F)
where F: FnMut(T),

source§

fn for_each_ref<F>(&self, action: F)
where F: FnMut(&T),

source§

fn for_each_mut<F>(&mut self, action: F)
where F: FnMut(&mut T),

source§

fn truncate<const M: usize>(self) -> [T; M]

source§

fn rtruncate<const M: usize>(self) -> [T; M]

source§

fn resize<const M: usize, F>(self, fill: F) -> [T; M]
where F: FnMut(usize) -> T,

source§

fn rresize<const M: usize, F>(self, fill: F) -> [T; M]
where F: FnMut(usize) -> T,

source§

fn into_rotate_left(self, n: usize) -> [T; N]

source§

fn into_rotate_right(self, n: usize) -> [T; N]

source§

fn into_shift_many_left<const M: usize>(self, items: [T; M]) -> ([T; M], [T; N])

source§

fn into_shift_many_right<const M: usize>( self, items: [T; M] ) -> ([T; N], [T; M])

source§

fn into_shift_left(self, item: T) -> (T, [T; N])

source§

fn into_shift_right(self, item: T) -> ([T; N], T)

source§

fn rotate_left2(&mut self, n: usize)

source§

fn rotate_right2(&mut self, n: usize)

source§

fn shift_many_left<const M: usize>(&mut self, items: [T; M]) -> [T; M]

source§

fn shift_many_right<const M: usize>(&mut self, items: [T; M]) -> [T; M]

source§

fn shift_left(&mut self, item: T) -> T

source§

fn shift_right(&mut self, item: T) -> T

source§

fn from_item(item: T) -> [T; 1]

source§

fn from_item_ref(item: &T) -> &[T; 1]

source§

fn from_item_mut(item: &mut T) -> &mut [T; 1]

source§

fn into_single_item(self) -> T

source§

fn try_into_single_item(self) -> Result<T, [T; N]>

source§

fn extend<const M: usize, F>(self, fill: F) -> [T; M]
where F: FnMut(usize) -> T,

source§

fn rextend<const M: usize, F>(self, fill: F) -> [T; M]
where F: FnMut(usize) -> T,

source§

fn reformulate_length<const M: usize>(self) -> [T; M]

source§

fn reformulate_length_ref<const M: usize>(&self) -> &[T; M]

source§

fn reformulate_length_mut<const M: usize>(&mut self) -> &mut [T; M]

source§

fn try_reformulate_length<const M: usize>(self) -> Result<[T; M], [T; N]>

source§

fn try_reformulate_length_ref<const M: usize>(&self) -> Option<&[T; M]>

source§

fn try_reformulate_length_mut<const M: usize>(&mut self) -> Option<&mut [T; M]>

source§

fn into_const_iter(self) -> IntoConstIter<T, N, true>

source§

fn into_const_iter_reverse(self) -> IntoConstIter<T, N, false>

source§

fn const_iter(&self) -> ConstIter<'_, T, N>

source§

fn const_iter_mut(&mut self) -> ConstIterMut<'_, T, N>

source§

fn map2<Map>(self, map: Map) -> [<Map as FnOnce(T)>::Output; N]
where Map: FnMut(T),

source§

fn map_outer<Map>(&self, map: Map) -> [[<Map as FnOnce(T, T)>::Output; N]; N]
where Map: FnMut(T, T), T: Copy,

source§

fn comap<Map, Rhs>( self, rhs: [Rhs; N], map: Map ) -> [<Map as FnOnce(T, Rhs)>::Output; N]
where Map: FnMut(T, Rhs),

source§

fn comap_outer<Map, Rhs, const M: usize>( &self, rhs: &[Rhs; M], map: Map ) -> [[<Map as FnOnce(T, Rhs)>::Output; M]; N]
where Map: FnMut(T, Rhs), T: Copy, Rhs: Copy,

source§

fn zip2<Z>(self, other: <[T; N] as ArrayOps<T, N>>::Array<Z, N>) -> [(T, Z); N]

source§

fn zip_outer<Z, const M: usize>( &self, other: &<[T; N] as ArrayOps<T, N>>::Array<Z, M> ) -> <[T; N] as ArrayOps<T, N>>::MappedTo<<[T; N] as ArrayOps<T, N>>::Array<(T, Z), M>>
where T: Copy, Z: Copy,

source§

fn enumerate(self) -> [(usize, T); N]

source§

fn diagonal<const H: usize, const W: usize>( self ) -> <[T; N] as ArrayOps<T, N>>::Array<<[T; N] as ArrayOps<T, N>>::Resized<W>, H>
where T: Default,

source§

fn differentiate(self) -> [<T as Sub>::Output; { _ }]
where T: Sub + Copy,

source§

fn integrate(self) -> [T; N]
where T: AddAssign + Copy,

source§

fn integrate_from<const M: usize>(self, x0: T) -> [T; M]
where T: AddAssign + Copy,

source§

fn reduce<R>(self, reduce: R) -> Option<T>
where R: FnMut(T, T) -> T,

source§

fn try_sum(self) -> Option<T>
where T: AddAssign,

source§

fn sum_from<S>(self, from: S) -> S
where S: AddAssign<T>,

source§

fn try_product(self) -> Option<T>
where T: MulAssign,

source§

fn product_from<P>(self, from: P) -> P
where P: MulAssign<T>,

source§

fn max(self) -> Option<T>
where T: Ord,

source§

fn min(self) -> Option<T>
where T: Ord,

source§

fn first_max(self) -> Option<T>
where T: PartialOrd,

source§

fn first_min(self) -> Option<T>
where T: PartialOrd,

source§

fn argmax(self) -> Option<usize>
where T: PartialOrd,

source§

fn argmin(self) -> Option<usize>
where T: PartialOrd,

source§

fn all(&self) -> bool
where T: Into<bool> + Copy,

source§

fn any(&self) -> bool
where T: Into<bool> + Copy,

source§

fn eq2<Rhs>(&self, rhs: &[Rhs]) -> bool
where T: PartialEq<Rhs>,

source§

fn add_all<Rhs>(self, rhs: Rhs) -> [<T as Add<Rhs>>::Output; N]
where T: Add<Rhs>, Rhs: Copy,

source§

fn sub_all<Rhs>(self, rhs: Rhs) -> [<T as Sub<Rhs>>::Output; N]
where T: Sub<Rhs>, Rhs: Copy,

source§

fn mul_all<Rhs>(self, rhs: Rhs) -> [<T as Mul<Rhs>>::Output; N]
where T: Mul<Rhs>, Rhs: Copy,

source§

fn div_all<Rhs>(self, rhs: Rhs) -> [<T as Div<Rhs>>::Output; N]
where T: Div<Rhs>, Rhs: Copy,

source§

fn add_all_neg<Rhs>( self, rhs: Rhs ) -> <[T; N] as ArrayOps<T, N>>::MappedTo<<Rhs as Sub<T>>::Output>
where Rhs: Copy + Sub<T>,

source§

fn mul_all_inv<Rhs>( self, rhs: Rhs ) -> <[T; N] as ArrayOps<T, N>>::MappedTo<<Rhs as Div<T>>::Output>
where Rhs: Copy + Div<T>,

source§

fn neg_all(self) -> [<T as Neg>::Output; N]
where T: Neg,

source§

fn add_each<Rhs>( self, rhs: <[T; N] as ArrayOps<T, N>>::MappedTo<Rhs> ) -> [<T as Add<Rhs>>::Output; N]
where T: Add<Rhs>,

source§

fn sub_each<Rhs>( self, rhs: <[T; N] as ArrayOps<T, N>>::MappedTo<Rhs> ) -> [<T as Sub<Rhs>>::Output; N]
where T: Sub<Rhs>,

source§

fn mul_each<Rhs>( self, rhs: <[T; N] as ArrayOps<T, N>>::MappedTo<Rhs> ) -> [<T as Mul<Rhs>>::Output; N]
where T: Mul<Rhs>,

source§

fn div_each<Rhs>( self, rhs: <[T; N] as ArrayOps<T, N>>::MappedTo<Rhs> ) -> [<T as Div<Rhs>>::Output; N]
where T: Div<Rhs>,

source§

fn try_mul_dot<Rhs>( self, rhs: <[T; N] as ArrayOps<T, N>>::MappedTo<Rhs> ) -> Option<<T as Mul<Rhs>>::Output>
where T: Mul<Rhs>, <T as Mul<Rhs>>::Output: AddAssign,

source§

fn mul_dot_bias<Rhs>( self, rhs: <[T; N] as ArrayOps<T, N>>::MappedTo<Rhs>, bias: <T as Mul<Rhs>>::Output ) -> <T as Mul<Rhs>>::Output
where T: Mul<Rhs>, <T as Mul<Rhs>>::Output: AddAssign,

source§

fn mul_outer<Rhs, const M: usize>( &self, rhs: &<[T; N] as ArrayOps<T, N>>::Array<Rhs, M> ) -> [[<T as Mul<Rhs>>::Output; M]; N]
where T: Mul<Rhs> + Copy, Rhs: Copy,

source§

fn mul_cross<Rhs>( &self, rhs: [&<[T; N] as ArrayOps<T, N>>::MappedTo<Rhs>; { _ }] ) -> <[T; N] as ArrayOps<T, N>>::MappedTo<<T as Sub>::Output>
where T: MulAssign<Rhs> + Sub + Copy, Rhs: Copy,

source§

fn try_magnitude_squared(self) -> Option<<T as Mul>::Output>
where T: Mul + Copy, <T as Mul>::Output: AddAssign,

source§

fn chain<const M: usize>( self, rhs: <[T; N] as ArrayOps<T, N>>::Array<T, M> ) -> [T; { _ }]

source§

fn rchain<const M: usize>( self, rhs: <[T; N] as ArrayOps<T, N>>::Array<T, M> ) -> [T; { _ }]

source§

fn array_spread<const M: usize>(self) -> ([[T; { _ }]; M], [T; { _ }])

source§

fn array_spread_ref<const M: usize>( &self ) -> ([&<[T; N] as ArrayOps<T, N>>::PaddedArray<T, M, array_trait::::array_ops::{impl#0}::array_spread_ref::{constant#2}>; M], &[T; { _ }])

source§

fn array_spread_mut<const M: usize>( &mut self ) -> ([&mut <[T; N] as ArrayOps<T, N>>::PaddedArray<T, M, array_trait::::array_ops::{impl#0}::array_spread_mut::{constant#2}>; M], &mut [T; { _ }])

source§

fn array_rspread<const M: usize>(self) -> ([T; { _ }], [[T; { _ }]; M])

source§

fn array_rspread_ref<const M: usize>( &self ) -> (&[T; { _ }], [&<[T; N] as ArrayOps<T, N>>::PaddedArray<T, M, array_trait::::array_ops::{impl#0}::array_rspread_ref::{constant#3}>; M])

source§

fn array_rspread_mut<const M: usize>( &mut self ) -> (&mut [T; { _ }], [&mut <[T; N] as ArrayOps<T, N>>::PaddedArray<T, M, array_trait::::array_ops::{impl#0}::array_rspread_mut::{constant#3}>; M])

source§

fn array_spread_exact<const M: usize>(self) -> [[T; { _ }]; M]

source§

fn array_spread_exact_ref<const M: usize>( &self ) -> [&<[T; N] as ArrayOps<T, N>>::PaddedArray<T, M, array_trait::::array_ops::{impl#0}::array_spread_exact_ref::{constant#2}>; M]

source§

fn array_spread_exact_mut<const M: usize>( &mut self ) -> [&mut <[T; N] as ArrayOps<T, N>>::PaddedArray<T, M, array_trait::::array_ops::{impl#0}::array_spread_exact_mut::{constant#2}>; M]

source§

fn array_chunks<const M: usize>(self) -> ([[T; M]; { _ }], [T; { _ }])

source§

fn array_chunks_ref<const M: usize>(&self) -> (&[[T; M]; { _ }], &[T; { _ }])

source§

fn array_chunks_mut<const M: usize>( &mut self ) -> (&mut [[T; M]; { _ }], &mut [T; { _ }])

source§

fn array_rchunks<const M: usize>(self) -> ([T; { _ }], [[T; M]; { _ }])

source§

fn array_rchunks_ref<const M: usize>(&self) -> (&[T; { _ }], &[[T; M]; { _ }])

source§

fn array_rchunks_mut<const M: usize>( &mut self ) -> (&mut [T; { _ }], &mut [[T; M]; { _ }])

source§

fn array_chunks_exact<const M: usize>(self) -> [[T; M]; { _ }]

source§

fn array_chunks_exact_ref<const M: usize>(&self) -> &[[T; M]; { _ }]

source§

fn array_chunks_exact_mut<const M: usize>(&mut self) -> &mut [[T; M]; { _ }]

source§

fn split_array<const M: usize>(self) -> ([T; M], [T; { _ }])

source§

fn split_array_ref2<const M: usize>(&self) -> (&[T; M], &[T; { _ }])

source§

fn split_array_mut2<const M: usize>(&mut self) -> (&mut [T; M], &mut [T; { _ }])

source§

fn rsplit_array<const M: usize>(self) -> ([T; { _ }], [T; M])

source§

fn rsplit_array_mut2<const M: usize>( &mut self ) -> (&mut [T; { _ }], &mut [T; M])

source§

fn rsplit_array_ref2<const M: usize>(&self) -> (&[T; { _ }], &[T; M])

source§

fn each_ref2<B>(&self) -> [&B; N]
where T: Borrow<B>,

source§

fn each_mut2<B>(&mut self) -> [&mut B; N]
where T: BorrowMut<B>,

Implementors§