[][src]Trait rug::ops::BitOrFrom

pub trait BitOrFrom<Lhs = Self> {
    fn bitor_from(&mut self, lhs: Lhs);
}

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

fn bitor_from(&mut self, lhs: Lhs)

Peforms the OR operation.

Examples

use rug::Integer;
use rug::ops::BitOrFrom;
let mut rhs = Integer::from(0xf0);
rhs.bitor_from(0x33);
// rhs = 0x33 | 0xf0
assert_eq!(rhs, 0xf3);
Loading content...

Implementations on Foreign Types

impl BitOrFrom<bool> for bool[src]

impl<'_> BitOrFrom<&'_ bool> for bool[src]

impl BitOrFrom<i8> for i8[src]

impl<'_> BitOrFrom<&'_ i8> for i8[src]

impl BitOrFrom<i16> for i16[src]

impl<'_> BitOrFrom<&'_ i16> for i16[src]

impl BitOrFrom<i32> for i32[src]

impl<'_> BitOrFrom<&'_ i32> for i32[src]

impl BitOrFrom<i64> for i64[src]

impl<'_> BitOrFrom<&'_ i64> for i64[src]

impl BitOrFrom<i128> for i128[src]

impl<'_> BitOrFrom<&'_ i128> for i128[src]

impl BitOrFrom<isize> for isize[src]

impl<'_> BitOrFrom<&'_ isize> for isize[src]

impl BitOrFrom<u8> for u8[src]

impl<'_> BitOrFrom<&'_ u8> for u8[src]

impl BitOrFrom<u16> for u16[src]

impl<'_> BitOrFrom<&'_ u16> for u16[src]

impl BitOrFrom<u32> for u32[src]

impl<'_> BitOrFrom<&'_ u32> for u32[src]

impl BitOrFrom<u64> for u64[src]

impl<'_> BitOrFrom<&'_ u64> for u64[src]

impl BitOrFrom<u128> for u128[src]

impl<'_> BitOrFrom<&'_ u128> for u128[src]

impl BitOrFrom<usize> for usize[src]

impl<'_> BitOrFrom<&'_ usize> for usize[src]

Loading content...

Implementors

impl BitOrFrom<i32> for Integer[src]

impl BitOrFrom<u32> for Integer[src]

impl BitOrFrom<Integer> for Integer[src]

impl<'_> BitOrFrom<&'_ i32> for Integer[src]

impl<'_> BitOrFrom<&'_ u32> for Integer[src]

impl<'_> BitOrFrom<&'_ Integer> for Integer[src]

Loading content...