Trait rug::ops::RemFrom [−][src]
Compound remainder operation and assignment to the rhs operand.
rhs.rem_from(lhs)
has the same effect as rhs = lhs % rhs
.
Examples
use rug::ops::RemFrom; struct I(i32); impl RemFrom<i32> for I { fn rem_from(&mut self, lhs: i32) { self.0 = lhs % self.0; } } let mut i = I(10); i.rem_from(42); assert_eq!(i.0, 2);
Required methods
fn rem_from(&mut self, lhs: Lhs)
[src]
Peforms the remainder operation.
Examples
use rug::{ops::RemFrom, Integer}; let mut rhs = Integer::from(2); rhs.rem_from(17); // rhs = 17 / 2 assert_eq!(rhs, 1);