Trait SliceNegAssign

Source
pub trait SliceNegAssign<T>: Slice<Item = T> {
    // Required methods
    const fn neg_assign_all(&mut self)
       where T: Neg<Output = T>;
    const async fn neg_assign_all_async(&mut self)
       where T: Neg<Output = T>;
}

Required Methods§

Source

const fn neg_assign_all(&mut self)
where T: Neg<Output = T>,

Negates each element in the slice.

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

const async fn neg_assign_all_async(&mut self)
where T: Neg<Output = T>,

Asynchronously negates each element in the slice.

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

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

Source§

fn neg_assign_all(&mut self)
where T: Neg<Output = T>,

Source§

async fn neg_assign_all_async(&mut self)
where T: Neg<Output = T>,

Implementors§