Trait std::ops::Shr [] [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

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

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

#[derive(Copy, Clone)]
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

The resulting type after applying the >> operator

Required Methods

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

The method for the >> operator

Implementors