Trait SliceShrAssign

Source
pub trait SliceShrAssign<T>: Slice<Item = T> {
    // Required methods
    const fn shr_assign_all<Rhs>(&mut self, rhs: Rhs)
       where T: ShrAssign<Rhs>,
             Rhs: Copy;
    const async fn shr_assign_all_async<Rhs>(&mut self, rhs: Rhs)
       where T: ShrAssign<Rhs>,
             Rhs: Copy;
}

Required Methods§

Source

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

Shifts each element to the right by rhs.

§Example
use slice_ops::ops::*;
 
let mut x = [0b1, 0b10, 0b11, 0b100, 0b101, 0b110, 0b111, 0b1000];
 
x.shr_assign_all(2);
    
assert_eq!(x, [0b0, 0b0, 0b0, 0b1, 0b1, 0b1, 0b1, 0b10]);
Source

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

Asynchronously shifts each element to the right by rhs.

§Example
use slice_ops::ops::*;
 
let mut x = [0b1, 0b10, 0b11, 0b100, 0b101, 0b110, 0b111, 0b1000];
 
x.shr_assign_all_async(2).await;
    
assert_eq!(x, [0b0, 0b0, 0b0, 0b1, 0b1, 0b1, 0b1, 0b10]);

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

Source§

fn shr_assign_all<Rhs>(&mut self, rhs: Rhs)
where T: ShrAssign<Rhs>, Rhs: Copy,

Source§

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

Implementors§