Trait rug::ops::AddFrom [−][src]
Compound addition and assignment to the rhs operand.
rhs.add_from(lhs)
has the same effect as rhs = lhs + rhs
.
Examples
use rug::ops::AddFrom; struct S(String); impl AddFrom<&str> for S { fn add_from(&mut self, lhs: &str) { self.0.insert_str(0, lhs); } } let mut s = S("world!".into()); s.add_from("Hello, "); assert_eq!(s.0, "Hello, world!");
Required methods
fn add_from(&mut self, lhs: Lhs)
[src]
Peforms the addition.
Examples
use rug::{ops::AddFrom, Integer}; let mut rhs = Integer::from(10); rhs.add_from(100); // rhs = 100 + 10 assert_eq!(rhs, 110);