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