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

pub trait Shl<RHS> {
    type Output;

    fn shl(self, rhs: RHS) -> Output;
}

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!.

#![feature(associated_types)] use std::ops::Shl; #[derive(Copy)] struct Foo; impl Shl<Foo> for Foo { type Output = Foo; fn shl(self, _rhs: Foo) -> Foo { println!("Shifting left!"); self } } fn main() { Foo << Foo; }
#![feature(associated_types)]

use std::ops::Shl;

#[derive(Copy)]
struct Foo;

impl Shl<Foo> for Foo {
    type Output = Foo;

    fn shl(self, _rhs: Foo) -> Foo {
        println!("Shifting left!");
        self
    }
}

fn main() {
    Foo << Foo;
}

Associated Types

type Output

Required Methods

fn shl(self, rhs: RHS) -> Output

The method for the << operator

Implementors