Trait SliceAddAssign

Source
pub trait SliceAddAssign<T>: Slice<Item = T> {
    // Required methods
    const fn add_assign_all<Rhs>(&mut self, rhs: Rhs)
       where T: AddAssign<Rhs>,
             Rhs: Copy;
    const async fn add_assign_all_async<Rhs>(&mut self, rhs: Rhs)
       where T: AddAssign<Rhs>,
             Rhs: Copy;
}

Required Methods§

Source

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

Adds rhs to each element in the slice.

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

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

Asynchronously adds rhs to each element in the slice.

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

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

Source§

fn add_assign_all<Rhs>(&mut self, rhs: Rhs)
where T: AddAssign<Rhs>, Rhs: Copy,

Source§

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

Implementors§