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

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

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

Examples

A trivial implementation of BitXor`BitXor. When`. When Foo ^ Foo`Foo ^ Foohappens, it ends up calling` happens, it ends up calling bitxor`bitxor, and therefore,`, and therefore, main`mainprints` prints Bitwise Xor-ing!`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