Trait std::ops::BitOr[src]

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

The BitOr trait is used to specify the functionality of |.

Example

A trivial implementation of BitOr. When Foo | Foo happens, it ends up calling bitor, and therefore, main prints Bitwise Or-ing!.

struct Foo; impl BitOr<Foo, Foo> for Foo { fn bitor(&self, _rhs: &Foo) -> Foo { println!("Bitwise Or-ing!"); *self } } fn main() { Foo | Foo; }
struct Foo;

impl BitOr<Foo, Foo> for Foo {
    fn bitor(&self, _rhs: &Foo) -> Foo {
        println!("Bitwise Or-ing!");
        *self
    }
}

fn main() {
    Foo | Foo;
}

Required Methods

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

The method for the | operator

Implementors