Trait core::ops::BitXorAssign 1.8.0[−][src]
pub trait BitXorAssign<Rhs = Self> { fn bitxor_assign(&mut self, rhs: Rhs); }
Expand description
按位 XOR 赋值运算符 ^=
。
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});Run