Trait std::ops::Shr [] [src]

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

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

Examples

A trivial implementation of Shr`Shr. When`. When Foo >> Foo`Foo >> Foohappens, it ends up calling` happens, it ends up calling shr`shr, and therefore,`, and therefore, main`mainprints` prints Shifting right!`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