# Trait std::ops::Shr1.0.0 [−] [src]

```pub trait Shr<RHS> {
type Output;
fn shr(self, rhs: RHS) -> Self::Output;
}```

The `Shr` trait is used to specify the functionality of `>>`.

# Examples

An implementation of `Shr` that lifts the `>>` operation on integers to a `Scalar` struct.

```use std::ops::Shr;

#[derive(PartialEq, Debug)]
struct Scalar(usize);

impl Shr<Scalar> for Scalar {
type Output = Self;

fn shr(self, Scalar(rhs): Self) -> Scalar {
let Scalar(lhs) = self;
Scalar(lhs >> rhs)
}
}
fn main() {
assert_eq!(Scalar(16) >> Scalar(2), Scalar(4));
}Run```

An implementation of `Shr` that spins a vector rightward by a given amount.

```use std::ops::Shr;

#[derive(PartialEq, Debug)]
struct SpinVector<T: Clone> {
vec: Vec<T>,
}

impl<T: Clone> Shr<usize> for SpinVector<T> {
type Output = Self;

fn shr(self, rhs: usize) -> SpinVector<T> {
// rotate the vector by `rhs` places
let (a, b) = self.vec.split_at(self.vec.len() - rhs);
let mut spun_vector: Vec<T> = vec![];
spun_vector.extend_from_slice(b);
spun_vector.extend_from_slice(a);
SpinVector { vec: spun_vector }
}
}

fn main() {
assert_eq!(SpinVector { vec: vec![0, 1, 2, 3, 4] } >> 2,
SpinVector { vec: vec![3, 4, 0, 1, 2] });
}Run```

## Associated Types

### `type Output`

The resulting type after applying the `>>` operator

## Required Methods

### `fn shr(self, rhs: RHS) -> Self::Output`

The method for the `>>` operator

## Implementors

• `impl Shr<usize> for Wrapping<u8>`
• `impl Shr<usize> for Wrapping<u16>`
• `impl Shr<usize> for Wrapping<u32>`
• `impl Shr<usize> for Wrapping<u64>`
• `impl Shr<usize> for Wrapping<usize>`
• `impl Shr<usize> for Wrapping<i8>`
• `impl Shr<usize> for Wrapping<i16>`
• `impl Shr<usize> for Wrapping<i32>`
• `impl Shr<usize> for Wrapping<i64>`
• `impl Shr<usize> for Wrapping<isize>`
• `impl Shr<u8> for u8`
• `impl<'a> Shr<u8> for &'a u8`
• `impl<'a> Shr<&'a u8> for u8`
• `impl<'a, 'b> Shr<&'a u8> for &'b u8`
• `impl Shr<u16> for u8`
• `impl<'a> Shr<u16> for &'a u8`
• `impl<'a> Shr<&'a u16> for u8`
• `impl<'a, 'b> Shr<&'a u16> for &'b u8`
• `impl Shr<u32> for u8`
• `impl<'a> Shr<u32> for &'a u8`
• `impl<'a> Shr<&'a u32> for u8`
• `impl<'a, 'b> Shr<&'a u32> for &'b u8`
• `impl Shr<u64> for u8`
• `impl<'a> Shr<u64> for &'a u8`
• `impl<'a> Shr<&'a u64> for u8`
• `impl<'a, 'b> Shr<&'a u64> for &'b u8`
• `impl Shr<usize> for u8`
• `impl<'a> Shr<usize> for &'a u8`
• `impl<'a> Shr<&'a usize> for u8`
• `impl<'a, 'b> Shr<&'a usize> for &'b u8`
• `impl Shr<i8> for u8`
• `impl<'a> Shr<i8> for &'a u8`
• `impl<'a> Shr<&'a i8> for u8`
• `impl<'a, 'b> Shr<&'a i8> for &'b u8`
• `impl Shr<i16> for u8`
• `impl<'a> Shr<i16> for &'a u8`
• `impl<'a> Shr<&'a i16> for u8`
• `impl<'a, 'b> Shr<&'a i16> for &'b u8`
• `impl Shr<i32> for u8`
• `impl<'a> Shr<i32> for &'a u8`
• `impl<'a> Shr<&'a i32> for u8`
• `impl<'a, 'b> Shr<&'a i32> for &'b u8`
• `impl Shr<i64> for u8`
• `impl<'a> Shr<i64> for &'a u8`
• `impl<'a> Shr<&'a i64> for u8`
• `impl<'a, 'b> Shr<&'a i64> for &'b u8`
• `impl Shr<isize> for u8`
• `impl<'a> Shr<isize> for &'a u8`
• `impl<'a> Shr<&'a isize> for u8`
• `impl<'a, 'b> Shr<&'a isize> for &'b u8`
• `impl Shr<u8> for u16`
• `impl<'a> Shr<u8> for &'a u16`
• `impl<'a> Shr<&'a u8> for u16`
• `impl<'a, 'b> Shr<&'a u8> for &'b u16`
• `impl Shr<u16> for u16`
• `impl<'a> Shr<u16> for &'a u16`
• `impl<'a> Shr<&'a u16> for u16`
• `impl<'a, 'b> Shr<&'a u16> for &'b u16`
• `impl Shr<u32> for u16`
• `impl<'a> Shr<u32> for &'a u16`
• `impl<'a> Shr<&'a u32> for u16`
• `impl<'a, 'b> Shr<&'a u32> for &'b u16`
• `impl Shr<u64> for u16`
• `impl<'a> Shr<u64> for &'a u16`
• `impl<'a> Shr<&'a u64> for u16`
• `impl<'a, 'b> Shr<&'a u64> for &'b u16`
• `impl Shr<usize> for u16`
• `impl<'a> Shr<usize> for &'a u16`
• `impl<'a> Shr<&'a usize> for u16`
• `impl<'a, 'b> Shr<&'a usize> for &'b u16`
• `impl Shr<i8> for u16`
• `impl<'a> Shr<i8> for &'a u16`
• `impl<'a> Shr<&'a i8> for u16`
• `impl<'a, 'b> Shr<&'a i8> for &'b u16`
• `impl Shr<i16> for u16`
• `impl<'a> Shr<i16> for &'a u16`
• `impl<'a> Shr<&'a i16> for u16`
• `impl<'a, 'b> Shr<&'a i16> for &'b u16`
• `impl Shr<i32> for u16`
• `impl<'a> Shr<i32> for &'a u16`
• `impl<'a> Shr<&'a i32> for u16`
• `impl<'a, 'b> Shr<&'a i32> for &'b u16`
• `impl Shr<i64> for u16`
• `impl<'a> Shr<i64> for &'a u16`
• `impl<'a> Shr<&'a i64> for u16`
• `impl<'a, 'b> Shr<&'a i64> for &'b u16`
• `impl Shr<isize> for u16`
• `impl<'a> Shr<isize> for &'a u16`
• `impl<'a> Shr<&'a isize> for u16`
• `impl<'a, 'b> Shr<&'a isize> for &'b u16`
• `impl Shr<u8> for u32`
• `impl<'a> Shr<u8> for &'a u32`
• `impl<'a> Shr<&'a u8> for u32`
• `impl<'a, 'b> Shr<&'a u8> for &'b u32`
• `impl Shr<u16> for u32`
• `impl<'a> Shr<u16> for &'a u32`
• `impl<'a> Shr<&'a u16> for u32`
• `impl<'a, 'b> Shr<&'a u16> for &'b u32`
• `impl Shr<u32> for u32`
• `impl<'a> Shr<u32> for &'a u32`
• `impl<'a> Shr<&'a u32> for u32`
• `impl<'a, 'b> Shr<&'a u32> for &'b u32`
• `impl Shr<u64> for u32`
• `impl<'a> Shr<u64> for &'a u32`
• `impl<'a> Shr<&'a u64> for u32`
• `impl<'a, 'b> Shr<&'a u64> for &'b u32`
• `impl Shr<usize> for u32`
• `impl<'a> Shr<usize> for &'a u32`
• `impl<'a> Shr<&'a usize> for u32`
• `impl<'a, 'b> Shr<&'a usize> for &'b u32`
• `impl Shr<i8> for u32`
• `impl<'a> Shr<i8> for &'a u32`
• `impl<'a> Shr<&'a i8> for u32`
• `impl<'a, 'b> Shr<&'a i8> for &'b u32`
• `impl Shr<i16> for u32`
• `impl<'a> Shr<i16> for &'a u32`
• `impl<'a> Shr<&'a i16> for u32`
• `impl<'a, 'b> Shr<&'a i16> for &'b u32`
• `impl Shr<i32> for u32`
• `impl<'a> Shr<i32> for &'a u32`
• `impl<'a> Shr<&'a i32> for u32`
• `impl<'a, 'b> Shr<&'a i32> for &'b u32`
• `impl Shr<i64> for u32`
• `impl<'a> Shr<i64> for &'a u32`
• `impl<'a> Shr<&'a i64> for u32`
• `impl<'a, 'b> Shr<&'a i64> for &'b u32`
• `impl Shr<isize> for u32`
• `impl<'a> Shr<isize> for &'a u32`
• `impl<'a> Shr<&'a isize> for u32`
• `impl<'a, 'b> Shr<&'a isize> for &'b u32`
• `impl Shr<u8> for u64`
• `impl<'a> Shr<u8> for &'a u64`
• `impl<'a> Shr<&'a u8> for u64`
• `impl<'a, 'b> Shr<&'a u8> for &'b u64`
• `impl Shr<u16> for u64`
• `impl<'a> Shr<u16> for &'a u64`
• `impl<'a> Shr<&'a u16> for u64`
• `impl<'a, 'b> Shr<&'a u16> for &'b u64`
• `impl Shr<u32> for u64`
• `impl<'a> Shr<u32> for &'a u64`
• `impl<'a> Shr<&'a u32> for u64`
• `impl<'a, 'b> Shr<&'a u32> for &'b u64`
• `impl Shr<u64> for u64`
• `impl<'a> Shr<u64> for &'a u64`
• `impl<'a> Shr<&'a u64> for u64`
• `impl<'a, 'b> Shr<&'a u64> for &'b u64`
• `impl Shr<usize> for u64`
• `impl<'a> Shr<usize> for &'a u64`
• `impl<'a> Shr<&'a usize> for u64`
• `impl<'a, 'b> Shr<&'a usize> for &'b u64`
• `impl Shr<i8> for u64`
• `impl<'a> Shr<i8> for &'a u64`
• `impl<'a> Shr<&'a i8> for u64`
• `impl<'a, 'b> Shr<&'a i8> for &'b u64`
• `impl Shr<i16> for u64`
• `impl<'a> Shr<i16> for &'a u64`
• `impl<'a> Shr<&'a i16> for u64`
• `impl<'a, 'b> Shr<&'a i16> for &'b u64`
• `impl Shr<i32> for u64`
• `impl<'a> Shr<i32> for &'a u64`
• `impl<'a> Shr<&'a i32> for u64`
• `impl<'a, 'b> Shr<&'a i32> for &'b u64`
• `impl Shr<i64> for u64`
• `impl<'a> Shr<i64> for &'a u64`
• `impl<'a> Shr<&'a i64> for u64`
• `impl<'a, 'b> Shr<&'a i64> for &'b u64`
• `impl Shr<isize> for u64`
• `impl<'a> Shr<isize> for &'a u64`
• `impl<'a> Shr<&'a isize> for u64`
• `impl<'a, 'b> Shr<&'a isize> for &'b u64`
• `impl Shr<u8> for usize`
• `impl<'a> Shr<u8> for &'a usize`
• `impl<'a> Shr<&'a u8> for usize`
• `impl<'a, 'b> Shr<&'a u8> for &'b usize`
• `impl Shr<u16> for usize`
• `impl<'a> Shr<u16> for &'a usize`
• `impl<'a> Shr<&'a u16> for usize`
• `impl<'a, 'b> Shr<&'a u16> for &'b usize`
• `impl Shr<u32> for usize`
• `impl<'a> Shr<u32> for &'a usize`
• `impl<'a> Shr<&'a u32> for usize`
• `impl<'a, 'b> Shr<&'a u32> for &'b usize`
• `impl Shr<u64> for usize`
• `impl<'a> Shr<u64> for &'a usize`
• `impl<'a> Shr<&'a u64> for usize`
• `impl<'a, 'b> Shr<&'a u64> for &'b usize`
• `impl Shr<usize> for usize`
• `impl<'a> Shr<usize> for &'a usize`
• `impl<'a> Shr<&'a usize> for usize`
• `impl<'a, 'b> Shr<&'a usize> for &'b usize`
• `impl Shr<i8> for usize`
• `impl<'a> Shr<i8> for &'a usize`
• `impl<'a> Shr<&'a i8> for usize`
• `impl<'a, 'b> Shr<&'a i8> for &'b usize`
• `impl Shr<i16> for usize`
• `impl<'a> Shr<i16> for &'a usize`
• `impl<'a> Shr<&'a i16> for usize`
• `impl<'a, 'b> Shr<&'a i16> for &'b usize`
• `impl Shr<i32> for usize`
• `impl<'a> Shr<i32> for &'a usize`
• `impl<'a> Shr<&'a i32> for usize`
• `impl<'a, 'b> Shr<&'a i32> for &'b usize`
• `impl Shr<i64> for usize`
• `impl<'a> Shr<i64> for &'a usize`
• `impl<'a> Shr<&'a i64> for usize`
• `impl<'a, 'b> Shr<&'a i64> for &'b usize`
• `impl Shr<isize> for usize`
• `impl<'a> Shr<isize> for &'a usize`
• `impl<'a> Shr<&'a isize> for usize`
• `impl<'a, 'b> Shr<&'a isize> for &'b usize`
• `impl Shr<u8> for i8`
• `impl<'a> Shr<u8> for &'a i8`
• `impl<'a> Shr<&'a u8> for i8`
• `impl<'a, 'b> Shr<&'a u8> for &'b i8`
• `impl Shr<u16> for i8`
• `impl<'a> Shr<u16> for &'a i8`
• `impl<'a> Shr<&'a u16> for i8`
• `impl<'a, 'b> Shr<&'a u16> for &'b i8`
• `impl Shr<u32> for i8`
• `impl<'a> Shr<u32> for &'a i8`
• `impl<'a> Shr<&'a u32> for i8`
• `impl<'a, 'b> Shr<&'a u32> for &'b i8`
• `impl Shr<u64> for i8`
• `impl<'a> Shr<u64> for &'a i8`
• `impl<'a> Shr<&'a u64> for i8`
• `impl<'a, 'b> Shr<&'a u64> for &'b i8`
• `impl Shr<usize> for i8`
• `impl<'a> Shr<usize> for &'a i8`
• `impl<'a> Shr<&'a usize> for i8`
• `impl<'a, 'b> Shr<&'a usize> for &'b i8`
• `impl Shr<i8> for i8`
• `impl<'a> Shr<i8> for &'a i8`
• `impl<'a> Shr<&'a i8> for i8`
• `impl<'a, 'b> Shr<&'a i8> for &'b i8`
• `impl Shr<i16> for i8`
• `impl<'a> Shr<i16> for &'a i8`
• `impl<'a> Shr<&'a i16> for i8`
• `impl<'a, 'b> Shr<&'a i16> for &'b i8`
• `impl Shr<i32> for i8`
• `impl<'a> Shr<i32> for &'a i8`
• `impl<'a> Shr<&'a i32> for i8`
• `impl<'a, 'b> Shr<&'a i32> for &'b i8`
• `impl Shr<i64> for i8`
• `impl<'a> Shr<i64> for &'a i8`
• `impl<'a> Shr<&'a i64> for i8`
• `impl<'a, 'b> Shr<&'a i64> for &'b i8`
• `impl Shr<isize> for i8`
• `impl<'a> Shr<isize> for &'a i8`
• `impl<'a> Shr<&'a isize> for i8`
• `impl<'a, 'b> Shr<&'a isize> for &'b i8`
• `impl Shr<u8> for i16`
• `impl<'a> Shr<u8> for &'a i16`
• `impl<'a> Shr<&'a u8> for i16`
• `impl<'a, 'b> Shr<&'a u8> for &'b i16`
• `impl Shr<u16> for i16`
• `impl<'a> Shr<u16> for &'a i16`
• `impl<'a> Shr<&'a u16> for i16`
• `impl<'a, 'b> Shr<&'a u16> for &'b i16`
• `impl Shr<u32> for i16`
• `impl<'a> Shr<u32> for &'a i16`
• `impl<'a> Shr<&'a u32> for i16`
• `impl<'a, 'b> Shr<&'a u32> for &'b i16`
• `impl Shr<u64> for i16`
• `impl<'a> Shr<u64> for &'a i16`
• `impl<'a> Shr<&'a u64> for i16`
• `impl<'a, 'b> Shr<&'a u64> for &'b i16`
• `impl Shr<usize> for i16`
• `impl<'a> Shr<usize> for &'a i16`
• `impl<'a> Shr<&'a usize> for i16`
• `impl<'a, 'b> Shr<&'a usize> for &'b i16`
• `impl Shr<i8> for i16`
• `impl<'a> Shr<i8> for &'a i16`
• `impl<'a> Shr<&'a i8> for i16`
• `impl<'a, 'b> Shr<&'a i8> for &'b i16`
• `impl Shr<i16> for i16`
• `impl<'a> Shr<i16> for &'a i16`
• `impl<'a> Shr<&'a i16> for i16`
• `impl<'a, 'b> Shr<&'a i16> for &'b i16`
• `impl Shr<i32> for i16`
• `impl<'a> Shr<i32> for &'a i16`
• `impl<'a> Shr<&'a i32> for i16`
• `impl<'a, 'b> Shr<&'a i32> for &'b i16`
• `impl Shr<i64> for i16`
• `impl<'a> Shr<i64> for &'a i16`
• `impl<'a> Shr<&'a i64> for i16`
• `impl<'a, 'b> Shr<&'a i64> for &'b i16`
• `impl Shr<isize> for i16`
• `impl<'a> Shr<isize> for &'a i16`
• `impl<'a> Shr<&'a isize> for i16`
• `impl<'a, 'b> Shr<&'a isize> for &'b i16`
• `impl Shr<u8> for i32`
• `impl<'a> Shr<u8> for &'a i32`
• `impl<'a> Shr<&'a u8> for i32`
• `impl<'a, 'b> Shr<&'a u8> for &'b i32`
• `impl Shr<u16> for i32`
• `impl<'a> Shr<u16> for &'a i32`
• `impl<'a> Shr<&'a u16> for i32`
• `impl<'a, 'b> Shr<&'a u16> for &'b i32`
• `impl Shr<u32> for i32`
• `impl<'a> Shr<u32> for &'a i32`
• `impl<'a> Shr<&'a u32> for i32`
• `impl<'a, 'b> Shr<&'a u32> for &'b i32`
• `impl Shr<u64> for i32`
• `impl<'a> Shr<u64> for &'a i32`
• `impl<'a> Shr<&'a u64> for i32`
• `impl<'a, 'b> Shr<&'a u64> for &'b i32`
• `impl Shr<usize> for i32`
• `impl<'a> Shr<usize> for &'a i32`
• `impl<'a> Shr<&'a usize> for i32`
• `impl<'a, 'b> Shr<&'a usize> for &'b i32`
• `impl Shr<i8> for i32`
• `impl<'a> Shr<i8> for &'a i32`
• `impl<'a> Shr<&'a i8> for i32`
• `impl<'a, 'b> Shr<&'a i8> for &'b i32`
• `impl Shr<i16> for i32`
• `impl<'a> Shr<i16> for &'a i32`
• `impl<'a> Shr<&'a i16> for i32`
• `impl<'a, 'b> Shr<&'a i16> for &'b i32`
• `impl Shr<i32> for i32`
• `impl<'a> Shr<i32> for &'a i32`
• `impl<'a> Shr<&'a i32> for i32`
• `impl<'a, 'b> Shr<&'a i32> for &'b i32`
• `impl Shr<i64> for i32`
• `impl<'a> Shr<i64> for &'a i32`
• `impl<'a> Shr<&'a i64> for i32`
• `impl<'a, 'b> Shr<&'a i64> for &'b i32`
• `impl Shr<isize> for i32`
• `impl<'a> Shr<isize> for &'a i32`
• `impl<'a> Shr<&'a isize> for i32`
• `impl<'a, 'b> Shr<&'a isize> for &'b i32`
• `impl Shr<u8> for i64`
• `impl<'a> Shr<u8> for &'a i64`
• `impl<'a> Shr<&'a u8> for i64`
• `impl<'a, 'b> Shr<&'a u8> for &'b i64`
• `impl Shr<u16> for i64`
• `impl<'a> Shr<u16> for &'a i64`
• `impl<'a> Shr<&'a u16> for i64`
• `impl<'a, 'b> Shr<&'a u16> for &'b i64`
• `impl Shr<u32> for i64`
• `impl<'a> Shr<u32> for &'a i64`
• `impl<'a> Shr<&'a u32> for i64`
• `impl<'a, 'b> Shr<&'a u32> for &'b i64`
• `impl Shr<u64> for i64`
• `impl<'a> Shr<u64> for &'a i64`
• `impl<'a> Shr<&'a u64> for i64`
• `impl<'a, 'b> Shr<&'a u64> for &'b i64`
• `impl Shr<usize> for i64`
• `impl<'a> Shr<usize> for &'a i64`
• `impl<'a> Shr<&'a usize> for i64`
• `impl<'a, 'b> Shr<&'a usize> for &'b i64`
• `impl Shr<i8> for i64`
• `impl<'a> Shr<i8> for &'a i64`
• `impl<'a> Shr<&'a i8> for i64`
• `impl<'a, 'b> Shr<&'a i8> for &'b i64`
• `impl Shr<i16> for i64`
• `impl<'a> Shr<i16> for &'a i64`
• `impl<'a> Shr<&'a i16> for i64`
• `impl<'a, 'b> Shr<&'a i16> for &'b i64`
• `impl Shr<i32> for i64`
• `impl<'a> Shr<i32> for &'a i64`
• `impl<'a> Shr<&'a i32> for i64`
• `impl<'a, 'b> Shr<&'a i32> for &'b i64`
• `impl Shr<i64> for i64`
• `impl<'a> Shr<i64> for &'a i64`
• `impl<'a> Shr<&'a i64> for i64`
• `impl<'a, 'b> Shr<&'a i64> for &'b i64`
• `impl Shr<isize> for i64`
• `impl<'a> Shr<isize> for &'a i64`
• `impl<'a> Shr<&'a isize> for i64`
• `impl<'a, 'b> Shr<&'a isize> for &'b i64`
• `impl Shr<u8> for isize`
• `impl<'a> Shr<u8> for &'a isize`
• `impl<'a> Shr<&'a u8> for isize`
• `impl<'a, 'b> Shr<&'a u8> for &'b isize`
• `impl Shr<u16> for isize`
• `impl<'a> Shr<u16> for &'a isize`
• `impl<'a> Shr<&'a u16> for isize`
• `impl<'a, 'b> Shr<&'a u16> for &'b isize`
• `impl Shr<u32> for isize`
• `impl<'a> Shr<u32> for &'a isize`
• `impl<'a> Shr<&'a u32> for isize`
• `impl<'a, 'b> Shr<&'a u32> for &'b isize`
• `impl Shr<u64> for isize`
• `impl<'a> Shr<u64> for &'a isize`
• `impl<'a> Shr<&'a u64> for isize`
• `impl<'a, 'b> Shr<&'a u64> for &'b isize`
• `impl Shr<usize> for isize`
• `impl<'a> Shr<usize> for &'a isize`
• `impl<'a> Shr<&'a usize> for isize`
• `impl<'a, 'b> Shr<&'a usize> for &'b isize`
• `impl Shr<i8> for isize`
• `impl<'a> Shr<i8> for &'a isize`
• `impl<'a> Shr<&'a i8> for isize`
• `impl<'a, 'b> Shr<&'a i8> for &'b isize`
• `impl Shr<i16> for isize`
• `impl<'a> Shr<i16> for &'a isize`
• `impl<'a> Shr<&'a i16> for isize`
• `impl<'a, 'b> Shr<&'a i16> for &'b isize`
• `impl Shr<i32> for isize`
• `impl<'a> Shr<i32> for &'a isize`
• `impl<'a> Shr<&'a i32> for isize`
• `impl<'a, 'b> Shr<&'a i32> for &'b isize`
• `impl Shr<i64> for isize`
• `impl<'a> Shr<i64> for &'a isize`
• `impl<'a> Shr<&'a i64> for isize`
• `impl<'a, 'b> Shr<&'a i64> for &'b isize`
• `impl Shr<isize> for isize`
• `impl<'a> Shr<isize> for &'a isize`
• `impl<'a> Shr<&'a isize> for isize`
• `impl<'a, 'b> Shr<&'a isize> for &'b isize`