Trait ArrayDivAssign

Source
pub trait ArrayDivAssign<T, const N: usize>: ArrayMeet<T, N> {
    // Required methods
    const fn div_assign_all<Rhs>(&mut self, rhs: Rhs)
       where T: DivAssign<Rhs>,
             Rhs: Copy;
    const async fn div_assign_all_async<Rhs>(&mut self, rhs: Rhs)
       where T: DivAssign<Rhs>,
             Rhs: Copy;
    const fn div_assign_each<Rhs>(&mut self, rhs: Rhs)
       where T: DivAssign<Rhs::Elem>,
             Rhs: ArrayForm<N>;
    const async fn div_assign_each_async<Rhs>(&mut self, rhs: Rhs)
       where T: DivAssign<Rhs::Elem>,
             Rhs: ArrayForm<N>;
}

Required Methods§

Source

const fn div_assign_all<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs>, Rhs: Copy,

Applies the /= operator to all elements, copying the operand for each operation.

§Examples
use array__ops::ops::*;
 
let mut a = [0, 1, 2, 3, 4, 5, 6, 7];
 
a.div_assign_all(2);
 
assert_eq!(a, [0, 0, 1, 1, 2, 2, 3, 3]);
Source

const async fn div_assign_all_async<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs>, Rhs: Copy,

Asynchronously applies the /= operator to all elements, copying the operand for each operation.

This way, each operation is a seperate async task that may be executed in parallel, but with some extra overhead.

§Examples
use array__ops::ops::*;
 
let mut a = [0, 1, 2, 3, 4, 5, 6, 7];
 
a.div_assign_all_async(2).await;
 
assert_eq!(a, [0, 0, 1, 1, 2, 2, 3, 3]);
Source

const fn div_assign_each<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs::Elem>, Rhs: ArrayForm<N>,

Applies *= rhs[..] to each element pairwise.

§Examples
use array__ops::ops::*;
 
let mut a = [7, 14, 21, 28, 35, 42, 49, 56];
let b = [1, 2, 3, 4, 5, 6, 7, 8];
 
a.div_assign_each(b);
 
assert_eq!(a, [7, 7, 7, 7, 7, 7, 7, 7]);
Source

const async fn div_assign_each_async<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs::Elem>, Rhs: ArrayForm<N>,

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.

Implementations on Foreign Types§

Source§

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

Source§

fn div_assign_all<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs>, Rhs: Copy,

Source§

async fn div_assign_all_async<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs>, Rhs: Copy,

Source§

fn div_assign_each<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs::Elem>, Rhs: ArrayForm<N>,

Source§

async fn div_assign_each_async<Rhs>(&mut self, rhs: Rhs)
where T: DivAssign<Rhs::Elem>, Rhs: ArrayForm<N>,

Implementors§