# Trait 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

- `impl BitOr<Wrapping<usize>> for Wrapping<usize>`
- `impl BitOr<Wrapping<u8>> for Wrapping<u8>`
- `impl BitOr<Wrapping<u16>> for Wrapping<u16>`
- `impl BitOr<Wrapping<u32>> for Wrapping<u32>`
- `impl BitOr<Wrapping<u64>> for Wrapping<u64>`
- `impl BitOr<Wrapping<isize>> for Wrapping<isize>`
- `impl BitOr<Wrapping<i8>> for Wrapping<i8>`
- `impl BitOr<Wrapping<i16>> for Wrapping<i16>`
- `impl BitOr<Wrapping<i32>> for Wrapping<i32>`
- `impl BitOr<Wrapping<i64>> for Wrapping<i64>`
- `impl BitOr<bool> for bool`
- `impl<'a> BitOr<bool> for &'a bool`
- `impl<'a> BitOr<&'a bool> for bool`
- `impl<'a, 'b> BitOr<&'a bool> for &'b bool`
- `impl BitOr<usize> for usize`
- `impl<'a> BitOr<usize> for &'a usize`
- `impl<'a> BitOr<&'a usize> for usize`
- `impl<'a, 'b> BitOr<&'a usize> for &'b usize`
- `impl BitOr<u8> for u8`
- `impl<'a> BitOr<u8> for &'a u8`
- `impl<'a> BitOr<&'a u8> for u8`
- `impl<'a, 'b> BitOr<&'a u8> for &'b u8`
- `impl BitOr<u16> for u16`
- `impl<'a> BitOr<u16> for &'a u16`
- `impl<'a> BitOr<&'a u16> for u16`
- `impl<'a, 'b> BitOr<&'a u16> for &'b u16`
- `impl BitOr<u32> for u32`
- `impl<'a> BitOr<u32> for &'a u32`
- `impl<'a> BitOr<&'a u32> for u32`
- `impl<'a, 'b> BitOr<&'a u32> for &'b u32`
- `impl BitOr<u64> for u64`
- `impl<'a> BitOr<u64> for &'a u64`
- `impl<'a> BitOr<&'a u64> for u64`
- `impl<'a, 'b> BitOr<&'a u64> for &'b u64`
- `impl BitOr<isize> for isize`
- `impl<'a> BitOr<isize> for &'a isize`
- `impl<'a> BitOr<&'a isize> for isize`
- `impl<'a, 'b> BitOr<&'a isize> for &'b isize`
- `impl BitOr<i8> for i8`
- `impl<'a> BitOr<i8> for &'a i8`
- `impl<'a> BitOr<&'a i8> for i8`
- `impl<'a, 'b> BitOr<&'a i8> for &'b i8`
- `impl BitOr<i16> for i16`
- `impl<'a> BitOr<i16> for &'a i16`
- `impl<'a> BitOr<&'a i16> for i16`
- `impl<'a, 'b> BitOr<&'a i16> for &'b i16`
- `impl BitOr<i32> for i32`
- `impl<'a> BitOr<i32> for &'a i32`
- `impl<'a> BitOr<&'a i32> for i32`
- `impl<'a, 'b> BitOr<&'a i32> for &'b i32`
- `impl BitOr<i64> for i64`
- `impl<'a> BitOr<i64> for &'a i64`
- `impl<'a> BitOr<&'a i64> for i64`
- `impl<'a, 'b> BitOr<&'a i64> for &'b i64`
- `impl<'a, 'b, T> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> where T: Ord + Clone`
- `impl<E> BitOr<EnumSet<E>> for EnumSet<E> where E: CLike`
- `impl<'a, 'b, T, S> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> where T: Eq + Hash + Clone, S: BuildHasher + Default`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize`)