Trait rug::ops::BitXorFrom
source · pub trait BitXorFrom<Lhs = Self> {
fn bitxor_from(&mut self, lhs: Lhs);
}
Expand description
Compound bitwise XOR and assignment to the rhs operand.
rhs.bitxor_from(lhs)
has the same effect as rhs = lhs ^ rhs
.
Examples
use rug::ops::BitXorFrom;
struct U(u32);
impl BitXorFrom<u32> for U {
fn bitxor_from(&mut self, lhs: u32) {
self.0 = lhs ^ self.0;
}
}
let mut u = U(0xf);
u.bitxor_from(0xff);
assert_eq!(u.0, 0xf0);
Required Methods
sourcefn bitxor_from(&mut self, lhs: Lhs)
fn bitxor_from(&mut self, lhs: Lhs)
Peforms the XOR operation.
Examples
use rug::ops::BitXorFrom;
use rug::Integer;
let mut rhs = Integer::from(0xf0);
rhs.bitxor_from(0x33);
// rhs = 0x33 ^ 0xf0
assert_eq!(rhs, 0xc3);