Trait std::ops::Shl [] [src]

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

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

Examples

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

use std::ops::Shl;

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