Trait SliceMulAssign

Source
pub trait SliceMulAssign<T>: Slice<Item = T> {
    // Required methods
    const fn mul_assign_all<Rhs>(&mut self, rhs: Rhs)
       where T: MulAssign<Rhs>,
             Rhs: Copy;
    const async fn mul_assign_all_async<Rhs>(&mut self, rhs: Rhs)
       where T: MulAssign<Rhs>,
             Rhs: Copy;
}

Required Methods§

Source

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

Multiplies rhs to each element in the slice.

§Example
use slice_ops::ops::*;
 
let mut x = [1, 2, 3, 4, 5, 6, 7, 8];
 
x.mul_assign_all(2);
    
assert_eq!(x, [2, 4, 6, 8, 10, 12, 14, 16]);
Source

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

Asynchronously multiplies rhs to each element in the slice.

§Example
use slice_ops::ops::*;
 
let mut x = [1, 2, 3, 4, 5, 6, 7, 8];
 
x.mul_assign_all_async(2).await;
    
assert_eq!(x, [2, 4, 6, 8, 10, 12, 14, 16]);

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> SliceMulAssign<T> for [T]

Source§

fn mul_assign_all<Rhs>(&mut self, rhs: Rhs)
where T: MulAssign<Rhs>, Rhs: Copy,

Source§

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

Implementors§