Trait rug::ops::SubFrom[][src]

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

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

Implementations on Foreign Types

impl SubFrom<i8> for i8[src]

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

impl SubFrom<i16> for i16[src]

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

impl SubFrom<i32> for i32[src]

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

impl SubFrom<i64> for i64[src]

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

impl SubFrom<i128> for i128[src]

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

impl SubFrom<isize> for isize[src]

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

impl SubFrom<u8> for u8[src]

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

impl SubFrom<u16> for u16[src]

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

impl SubFrom<u32> for u32[src]

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

impl SubFrom<u64> for u64[src]

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

impl SubFrom<u128> for u128[src]

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

impl SubFrom<usize> for usize[src]

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

impl SubFrom<f32> for f32[src]

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

impl SubFrom<f64> for f64[src]

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

Loading content...

Implementors

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl SubFrom<f32> for Float[src]

impl SubFrom<f64> for Float[src]

impl SubFrom<i8> for Float[src]

impl SubFrom<i8> for Integer[src]

impl SubFrom<i16> for Float[src]

impl SubFrom<i16> for Integer[src]

impl SubFrom<i32> for Float[src]

impl SubFrom<i32> for Integer[src]

impl SubFrom<i64> for Float[src]

impl SubFrom<i64> for Integer[src]

impl SubFrom<i128> for Float[src]

impl SubFrom<i128> for Integer[src]

impl SubFrom<u8> for Float[src]

impl SubFrom<u8> for Integer[src]

impl SubFrom<u16> for Float[src]

impl SubFrom<u16> for Integer[src]

impl SubFrom<u32> for Float[src]

impl SubFrom<u32> for Integer[src]

impl SubFrom<u64> for Float[src]

impl SubFrom<u64> for Integer[src]

impl SubFrom<u128> for Float[src]

impl SubFrom<u128> for Integer[src]

impl SubFrom<Float> for Float[src]

impl SubFrom<Integer> for Float[src]

impl SubFrom<Integer> for Integer[src]

Loading content...