Trait std::ops::BitXorAssign1.8.0 [] [src]

pub trait BitXorAssign<Rhs = Self> {
    fn bitxor_assign(&mut self, Rhs);

The BitXorAssign trait is used to specify the functionality of ^=.


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

use std::ops::BitXorAssign;

struct Foo;

impl BitXorAssign for Foo {
    fn bitxor_assign(&mut self, _rhs: Foo) {
        println!("Bitwise Xor-ing!");

fn main() {
    let mut foo = Foo;
    foo ^= Foo;

Required Methods

The method for the ^= operator