Trait core::ops::BitXor[src]

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

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

Example

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

struct Foo; impl BitXor<Foo, Foo> for Foo { fn bitxor(&self, _rhs: &Foo) -> Foo { println!("Bitwise Xor-ing!"); *self } } fn main() { Foo ^ Foo; }
struct Foo;

impl BitXor<Foo, Foo> for Foo {
    fn bitxor(&self, _rhs: &Foo) -> Foo {
        println!("Bitwise Xor-ing!");
        *self
    }
}

fn main() {
    Foo ^ Foo;
}

Required Methods

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

The method for the ^ operator

Implementors