Trait rug::ops::DivFrom [−][src]
Compound division and assignment to the rhs operand.
rhs.div_from(lhs)
has the same effect as rhs = lhs / rhs
.
Examples
use rug::ops::DivFrom; struct I(i32); impl DivFrom<i32> for I { fn div_from(&mut self, lhs: i32) { self.0 = lhs / self.0; } } let mut i = I(10); i.div_from(42); assert_eq!(i.0, 4);
Required methods
fn div_from(&mut self, lhs: Lhs)
[src]
Peforms the division.
Examples
use rug::{ops::DivFrom, Integer}; let mut rhs = Integer::from(5); rhs.div_from(50); // rhs = 50 / 5 assert_eq!(rhs, 10);