Trait sp_std::ops::BitXorAssign

1.8.0 · source · []
pub trait BitXorAssign<Rhs = Self> {
    fn bitxor_assign(&mut self, rhs: Rhs);
}
Expand description

The bitwise XOR assignment operator ^=.

Examples

use std::ops::BitXorAssign;

#[derive(Debug, PartialEq)]
struct Personality {
    has_soul: bool,
    likes_knitting: bool,
}

impl BitXorAssign for Personality {
    fn bitxor_assign(&mut self, rhs: Self) {
        self.has_soul ^= rhs.has_soul;
        self.likes_knitting ^= rhs.likes_knitting;
    }
}

let mut personality = Personality { has_soul: false, likes_knitting: true };
personality ^= Personality { has_soul: true, likes_knitting: true };
assert_eq!(personality, Personality { has_soul: true, likes_knitting: false});

Required methods

Performs the ^= operation.

Examples
let mut x = true;
x ^= false;
assert_eq!(x, true);

let mut x = true;
x ^= true;
assert_eq!(x, false);

let mut x: u8 = 5;
x ^= 1;
assert_eq!(x, 4);

let mut x: u8 = 5;
x ^= 2;
assert_eq!(x, 7);

Implementations on Foreign Types

Implementors

impl<O, V, Rhs> BitXorAssign<Rhs> for BitArray<O, V> where
    O: BitOrder,
    V: BitView,
    BitSlice<O, V::Store>: BitXorAssign<Rhs>, 

impl<O, T, Rhs> BitXorAssign<Rhs> for BitSlice<O, T> where
    O: BitOrder,
    T: BitStore,
    Rhs: IntoIterator<Item = bool>, 

impl<O, T, Rhs> BitXorAssign<Rhs> for BitBox<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T>: BitXorAssign<Rhs>, 

impl<O, T, Rhs> BitXorAssign<Rhs> for BitVec<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T>: BitXorAssign<Rhs>, 

impl<T: Into<Ready>> BitXorAssign<T> for Ready

impl<'a> BitXorAssign<&'a BigInt> for BigInt

impl<'a> BitXorAssign<&'a BigUint> for BigUint

impl<'r> BitXorAssign<&'r H128> for H128

impl<'r> BitXorAssign<&'r H160> for H160

impl<'r> BitXorAssign<&'r H256> for H256

impl<'r> BitXorAssign<&'r H512> for H512