Trait core::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>>`.

Examples

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