# Trait std::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

- `impl BitXorAssign<Wrapping<usize>> for Wrapping<usize>`
- `impl BitXorAssign<Wrapping<u8>> for Wrapping<u8>`
- `impl BitXorAssign<Wrapping<u16>> for Wrapping<u16>`
- `impl BitXorAssign<Wrapping<u32>> for Wrapping<u32>`
- `impl BitXorAssign<Wrapping<u64>> for Wrapping<u64>`
- `impl BitXorAssign<Wrapping<isize>> for Wrapping<isize>`
- `impl BitXorAssign<Wrapping<i8>> for Wrapping<i8>`
- `impl BitXorAssign<Wrapping<i16>> for Wrapping<i16>`
- `impl BitXorAssign<Wrapping<i32>> for Wrapping<i32>`
- `impl BitXorAssign<Wrapping<i64>> for Wrapping<i64>`
- `impl BitXorAssign<bool> for bool`
- `impl BitXorAssign<usize> for usize`
- `impl BitXorAssign<u8> for u8`
- `impl BitXorAssign<u16> for u16`
- `impl BitXorAssign<u32> for u32`
- `impl BitXorAssign<u64> for u64`
- `impl BitXorAssign<isize> for isize`
- `impl BitXorAssign<i8> for i8`
- `impl BitXorAssign<i16> for i16`
- `impl BitXorAssign<i32> for i32`
- `impl BitXorAssign<i64> for i64`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize`)