pub trait DivFrom<Lhs = Self> {
fn div_from(&mut self, lhs: Lhs);
}
Expand description
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);