W3cubDocs

/Rust

Trait std::ops::BitXorAssign

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

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

Examples

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

Implementors

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ops/trait.BitXorAssign.html