Trait rug::ops::AddFrom[][src]

pub trait AddFrom<Lhs = Self> {
    fn add_from(&mut self, lhs: Lhs);
}

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);
Loading content...

Implementations on Foreign Types

impl AddFrom<i8> for i8[src]

impl AddFrom<&'_ i8> for i8[src]

impl AddFrom<i16> for i16[src]

impl AddFrom<&'_ i16> for i16[src]

impl AddFrom<i32> for i32[src]

impl AddFrom<&'_ i32> for i32[src]

impl AddFrom<i64> for i64[src]

impl AddFrom<&'_ i64> for i64[src]

impl AddFrom<i128> for i128[src]

impl AddFrom<&'_ i128> for i128[src]

impl AddFrom<isize> for isize[src]

impl AddFrom<&'_ isize> for isize[src]

impl AddFrom<u8> for u8[src]

impl AddFrom<&'_ u8> for u8[src]

impl AddFrom<u16> for u16[src]

impl AddFrom<&'_ u16> for u16[src]

impl AddFrom<u32> for u32[src]

impl AddFrom<&'_ u32> for u32[src]

impl AddFrom<u64> for u64[src]

impl AddFrom<&'_ u64> for u64[src]

impl AddFrom<u128> for u128[src]

impl AddFrom<&'_ u128> for u128[src]

impl AddFrom<usize> for usize[src]

impl AddFrom<&'_ usize> for usize[src]

impl AddFrom<f32> for f32[src]

impl AddFrom<&'_ f32> for f32[src]

impl AddFrom<f64> for f64[src]

impl AddFrom<&'_ f64> for f64[src]

impl AddFrom<&'_ str> for String[src]

impl<'a> AddFrom<&'a str> for Cow<'a, str>[src]

impl<'a> AddFrom<Cow<'a, str>> for Cow<'a, str>[src]

Loading content...

Implementors

impl AddFrom<&'_ f32> for Float[src]

impl AddFrom<&'_ f64> for Float[src]

impl AddFrom<&'_ i8> for Float[src]

impl AddFrom<&'_ i8> for Integer[src]

impl AddFrom<&'_ i16> for Float[src]

impl AddFrom<&'_ i16> for Integer[src]

impl AddFrom<&'_ i32> for Float[src]

impl AddFrom<&'_ i32> for Integer[src]

impl AddFrom<&'_ i64> for Float[src]

impl AddFrom<&'_ i64> for Integer[src]

impl AddFrom<&'_ i128> for Float[src]

impl AddFrom<&'_ i128> for Integer[src]

impl AddFrom<&'_ u8> for Float[src]

impl AddFrom<&'_ u8> for Integer[src]

impl AddFrom<&'_ u16> for Float[src]

impl AddFrom<&'_ u16> for Integer[src]

impl AddFrom<&'_ u32> for Float[src]

impl AddFrom<&'_ u32> for Integer[src]

impl AddFrom<&'_ u64> for Float[src]

impl AddFrom<&'_ u64> for Integer[src]

impl AddFrom<&'_ u128> for Float[src]

impl AddFrom<&'_ u128> for Integer[src]

impl AddFrom<&'_ Float> for Float[src]

impl AddFrom<&'_ Integer> for Float[src]

impl AddFrom<&'_ Integer> for Integer[src]

impl AddFrom<f32> for Float[src]

impl AddFrom<f64> for Float[src]

impl AddFrom<i8> for Float[src]

impl AddFrom<i8> for Integer[src]

impl AddFrom<i16> for Float[src]

impl AddFrom<i16> for Integer[src]

impl AddFrom<i32> for Float[src]

impl AddFrom<i32> for Integer[src]

impl AddFrom<i64> for Float[src]

impl AddFrom<i64> for Integer[src]

impl AddFrom<i128> for Float[src]

impl AddFrom<i128> for Integer[src]

impl AddFrom<u8> for Float[src]

impl AddFrom<u8> for Integer[src]

impl AddFrom<u16> for Float[src]

impl AddFrom<u16> for Integer[src]

impl AddFrom<u32> for Float[src]

impl AddFrom<u32> for Integer[src]

impl AddFrom<u64> for Float[src]

impl AddFrom<u64> for Integer[src]

impl AddFrom<u128> for Float[src]

impl AddFrom<u128> for Integer[src]

impl AddFrom<Float> for Float[src]

impl AddFrom<Integer> for Float[src]

impl AddFrom<Integer> for Integer[src]

Loading content...