Trait rug::ops::BitAndFrom

source ·
pub trait BitAndFrom<Lhs = Self> {
    // Required method
    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§

source

fn bitand_from(&mut self, lhs: Lhs)

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§

source§

impl BitAndFrom for bool

source§

fn bitand_from(&mut self, lhs: bool)

source§

impl BitAndFrom for i8

source§

fn bitand_from(&mut self, lhs: i8)

source§

impl BitAndFrom for i16

source§

fn bitand_from(&mut self, lhs: i16)

source§

impl BitAndFrom for i32

source§

fn bitand_from(&mut self, lhs: i32)

source§

impl BitAndFrom for i64

source§

fn bitand_from(&mut self, lhs: i64)

source§

impl BitAndFrom for i128

source§

fn bitand_from(&mut self, lhs: i128)

source§

impl BitAndFrom for isize

source§

fn bitand_from(&mut self, lhs: isize)

source§

impl BitAndFrom for u8

source§

fn bitand_from(&mut self, lhs: u8)

source§

impl BitAndFrom for u16

source§

fn bitand_from(&mut self, lhs: u16)

source§

impl BitAndFrom for u32

source§

fn bitand_from(&mut self, lhs: u32)

source§

impl BitAndFrom for u64

source§

fn bitand_from(&mut self, lhs: u64)

source§

impl BitAndFrom for u128

source§

fn bitand_from(&mut self, lhs: u128)

source§

impl BitAndFrom for usize

source§

fn bitand_from(&mut self, lhs: usize)

source§

impl BitAndFrom<&bool> for bool

source§

fn bitand_from(&mut self, lhs: &bool)

source§

impl BitAndFrom<&i8> for i8

source§

fn bitand_from(&mut self, lhs: &i8)

source§

impl BitAndFrom<&i16> for i16

source§

fn bitand_from(&mut self, lhs: &i16)

source§

impl BitAndFrom<&i32> for i32

source§

fn bitand_from(&mut self, lhs: &i32)

source§

impl BitAndFrom<&i64> for i64

source§

fn bitand_from(&mut self, lhs: &i64)

source§

impl BitAndFrom<&i128> for i128

source§

fn bitand_from(&mut self, lhs: &i128)

source§

impl BitAndFrom<&isize> for isize

source§

fn bitand_from(&mut self, lhs: &isize)

source§

impl BitAndFrom<&u8> for u8

source§

fn bitand_from(&mut self, lhs: &u8)

source§

impl BitAndFrom<&u16> for u16

source§

fn bitand_from(&mut self, lhs: &u16)

source§

impl BitAndFrom<&u32> for u32

source§

fn bitand_from(&mut self, lhs: &u32)

source§

impl BitAndFrom<&u64> for u64

source§

fn bitand_from(&mut self, lhs: &u64)

source§

impl BitAndFrom<&u128> for u128

source§

fn bitand_from(&mut self, lhs: &u128)

source§

impl BitAndFrom<&usize> for usize

source§

fn bitand_from(&mut self, lhs: &usize)

Implementors§