Trait core::ops::BitAnd[src]

pub trait BitAnd<RHS, Result> {
    fn bitand(&self, rhs: &RHS) -> Result;
}

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

Example

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

struct Foo; impl BitAnd<Foo, Foo> for Foo { fn bitand(&self, _rhs: &Foo) -> Foo { println!("Bitwise And-ing!"); *self } } fn main() { Foo & Foo; }
struct Foo;

impl BitAnd<Foo, Foo> for Foo {
    fn bitand(&self, _rhs: &Foo) -> Foo {
        println!("Bitwise And-ing!");
        *self
    }
}

fn main() {
    Foo & Foo;
}

Required Methods

fn bitand(&self, rhs: &RHS) -> Result

The method for the & operator

Implementors