Trait core::ops::ShrStable [-]  [+] [src]

pub trait Shr<RHS> {
    type Output;

    fn shr(self, rhs: RHS) -> Output;
}

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

Example

A trivial implementation of Shr. When Foo >> Foo happens, it ends up calling shr, and therefore, main prints Shifting right!.

#![feature(associated_types)] use std::ops::Shr; #[derive(Copy)] struct Foo; impl Shr<Foo> for Foo { type Output = Foo; fn shr(self, _rhs: Foo) -> Foo { println!("Shifting right!"); self } } fn main() { Foo >> Foo; }
#![feature(associated_types)]

use std::ops::Shr;

#[derive(Copy)]
struct Foo;

impl Shr<Foo> for Foo {
    type Output = Foo;

    fn shr(self, _rhs: Foo) -> Foo {
        println!("Shifting right!");
        self
    }
}

fn main() {
    Foo >> Foo;
}

Associated Types

type Output

Required Methods

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

The method for the >> operator

Implementors