Trait rug::ops::BitAndFrom

source ·
pub trait BitAndFrom<Lhs = Self> {
    fn bitand_from(&mut self, lhs: Lhs);
}
Expand description

Compound bitwise AND and assignment to the rhs operand.

rhs.bitand_from(lhs) has the same effect as rhs = lhs & rhs.

Examples

use rug::ops::BitAndFrom;
struct U(u32);
impl BitAndFrom<u32> for U {
    fn bitand_from(&mut self, lhs: u32) {
        self.0 = lhs & self.0;
    }
}
let mut u = U(0xff);
u.bitand_from(0xf0);
assert_eq!(u.0, 0xf0);

Required Methods

Peforms the AND operation.

Examples
use rug::ops::BitAndFrom;
use rug::Integer;
let mut rhs = Integer::from(0xf0);
rhs.bitand_from(0x33);
// rhs = 0x33 & 0xf0
assert_eq!(rhs, 0x30);

Implementations on Foreign Types

Implementors