Trait std::ops::Shl[src]

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

The Shl trait is used to specify the functionality of <<.

Example

A trivial implementation of Shl. When Foo << Foo happens, it ends up calling shl, and therefore, main prints Shifting left!.

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

impl Shl<Foo, Foo> for Foo {
    fn shl(&self, _rhs: &Foo) -> Foo {
        println!("Shifting left!");
        *self
    }
}

fn main() {
    Foo << Foo;
}

Required Methods

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

The method for the << operator

Implementors