Trait core::ops::ShlExperimental [-]  [+] [src]

pub trait Shl<RHS, Result> {
    fn shl(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!.

#[deriving(Copy)] struct Foo; impl Shl<Foo, Foo> for Foo { fn shl(self, _rhs: Foo) -> Foo { println!("Shifting left!"); self } } fn main() { Foo << Foo; }
#[deriving(Copy)]
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(self, rhs: RHS) -> Result

The method for the << operator

Implementors