Trait core::ops::Shl [] [src]

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

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

Examples

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

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

#[derive(Copy, Clone)]
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

The resulting type after applying the <<`<<` operator

Required Methods

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

The method for the <<`<<` operator

Implementors