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

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

The `Shl` trait is used to specify the functionality of `<<`.

# Examples

An implementation of `Shl` that lifts the `<<` operation on integers to a `Scalar` struct.

```use std::ops::Shl;

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

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

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

An implementation of `Shl` that spins a vector leftward by a given amount.

```use std::ops::Shl;

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

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

fn shl(self, rhs: usize) -> SpinVector<T> {
// rotate the vector by `rhs` places
let (a, b) = self.vec.split_at(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![2, 3, 4, 0, 1] });
}Run```

## Associated Types

### `type Output`

The resulting type after applying the `<<` operator

## Required Methods

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

The method for the `<<` operator

## Implementors

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