Trait collections::std::ops::BitOr [] [src]

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

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

Examples

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

use std::ops::BitOr; struct Foo; impl BitOr for Foo { type Output = Foo; fn bitor(self, _rhs: Foo) -> Foo { println!("Bitwise Or-ing!"); self } } fn main() { Foo | Foo; }
use std::ops::BitOr;

struct Foo;

impl BitOr for Foo {
    type Output = Foo;

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

fn main() {
    Foo | Foo;
}

Associated Types

type Output

The resulting type after applying the | operator

Required Methods

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

The method for the | operator

Implementors