Trait SliceSubAssign

Source
pub trait SliceSubAssign<T>: Slice<Item = T> {
    // Required methods
    const fn sub_assign_all<Rhs>(&mut self, rhs: Rhs)
       where T: SubAssign<Rhs>,
             Rhs: Copy;
    const async fn sub_assign_all_async<Rhs>(&mut self, rhs: Rhs)
       where T: SubAssign<Rhs>,
             Rhs: Copy;
    const fn rsub_assign_all<Lhs>(&mut self, lhs: Lhs)
       where Lhs: Copy + Sub<T, Output = T>;
    const async fn rsub_assign_all_async<Lhs>(&mut self, lhs: Lhs)
       where Lhs: Copy + Sub<T, Output = T>;
}

Required Methods§

Source

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

Subtracts each element in the slice by rhs.

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

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

Asynchronously subtracts each element in the slice by rhs.

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

const fn rsub_assign_all<Lhs>(&mut self, lhs: Lhs)
where Lhs: Copy + Sub<T, Output = T>,

TODO

Source

const async fn rsub_assign_all_async<Lhs>(&mut self, lhs: Lhs)
where Lhs: Copy + Sub<T, Output = T>,

TODO

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

Source§

fn sub_assign_all<Rhs>(&mut self, rhs: Rhs)
where T: SubAssign<Rhs>, Rhs: Copy,

Source§

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

Source§

fn rsub_assign_all<Lhs>(&mut self, lhs: Lhs)
where Lhs: Copy + Sub<T, Output = T>,

Source§

async fn rsub_assign_all_async<Lhs>(&mut self, lhs: Lhs)
where Lhs: Copy + Sub<T, Output = T>,

Implementors§