Trait core::ops::BitXor [] [src]

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

The BitXor trait is used to specify the functionality of ^.

Examples

A trivial implementation of BitXor. When Foo ^ Foo happens, it ends up calling bitxor, and therefore, main prints Bitwise Xor-ing!.

use std::ops::BitXor; #[derive(Copy, Clone)] struct Foo; impl BitXor for Foo { type Output = Foo; fn bitxor(self, _rhs: Foo) -> Foo { println!("Bitwise Xor-ing!"); self } } fn main() { Foo ^ Foo; }
use std::ops::BitXor;

#[derive(Copy, Clone)]
struct Foo;

impl BitXor for Foo {
    type Output = Foo;

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

fn main() {
    Foo ^ Foo;
}

Associated Types

type Output

The resulting type after applying the ^ operator

Required Methods

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

The method for the ^ operator

Implementors