Trait core::ops::BitOrExperimental [-]  [+] [src]

pub trait BitOr<RHS, Result> {
    fn bitor(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!.

#[deriving(Copy)] struct Foo; impl BitOr<Foo, Foo> for Foo { fn bitor(self, _rhs: Foo) -> Foo { println!("Bitwise Or-ing!"); self } } fn main() { Foo | Foo; }
#[deriving(Copy)]
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(self, rhs: RHS) -> Result

The method for the | operator

Implementors