Trait core::ops::BitXorAssign [] [src]

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

: recently added

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!.

#![feature(augmented_assignments)] #![feature(op_assign_traits)] use std::ops::BitXorAssign; struct Foo; impl BitXorAssign for Foo { fn bitxor_assign(&mut self, _rhs: Foo) { println!("Bitwise Xor-ing!"); } } #[allow(unused_assignments)] fn main() { let mut foo = Foo; foo ^= Foo; }
#![feature(augmented_assignments)]
#![feature(op_assign_traits)]

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

fn bitxor_assign(&mut self, Rhs)

Unstable (op_assign_traits #28235)

: recently added

The method for the ^= operator

Implementors