Trait std::ops::BitAnd [] [src]

pub trait BitAnd<RHS = Self> {
    type Output;
    fn bitand(self, rhs: RHS) -> Self::Output;
}

The BitAnd trait is used to specify the functionality of &.

Examples

A trivial implementation of BitAnd. When Foo & Foo happens, it ends up calling bitand, and therefore, main prints Bitwise And-ing!.

use std::ops::BitAnd;

struct Foo;

impl BitAnd for Foo {
    type Output = Foo;

    fn bitand(self, _rhs: Foo) -> Foo {
        println!("Bitwise And-ing!");
        self
    }
}

fn main() {
    Foo & Foo;
}

Associated Types

type Output

The resulting type after applying the & operator

Required Methods

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

The method for the & operator

Implementors