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