pub trait PowAssign<Rhs> {
// Required method
fn pow_assign(&mut self, rhs: Rhs);
}
Expand description
Compound power operation and assignment.
Examples
use rug::ops::PowAssign;
struct U(u32);
impl PowAssign<u16> for U {
fn pow_assign(&mut self, rhs: u16) {
self.0 = self.0.pow(u32::from(rhs));
}
}
let mut u = U(5);
u.pow_assign(2_u16);
assert_eq!(u.0, 25);
Required Methods§
sourcefn pow_assign(&mut self, rhs: Rhs)
fn pow_assign(&mut self, rhs: Rhs)
Peforms the power operation.
Examples
use rug::ops::PowAssign;
use rug::Integer;
let mut i = Integer::from(10);
i.pow_assign(5);
assert_eq!(i, 100_000);