Trait core::ops::Shr[src]

pub trait Shr<RHS, Result> {
    fn shr(&self, rhs: &RHS) -> Result;
}

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!.

struct Foo; impl Shr<Foo, Foo> for Foo { fn shr(&self, _rhs: &Foo) -> Foo { println!("Shifting right!"); *self } } fn main() { Foo >> Foo; }
struct Foo;

impl Shr<Foo, Foo> for Foo {
    fn shr(&self, _rhs: &Foo) -> Foo {
        println!("Shifting right!");
        *self
    }
}

fn main() {
    Foo >> Foo;
}

Required Methods

fn shr(&self, rhs: &RHS) -> Result

The method for the >> operator

Implementors