Trait rug::ops::DivRoundingFrom [−][src]
pub trait DivRoundingFrom<Lhs = Self> { fn div_trunc_from(&mut self, lhs: Lhs); fn div_ceil_from(&mut self, lhs: Lhs); fn div_floor_from(&mut self, lhs: Lhs); fn div_euc_from(&mut self, lhs: Lhs); }
Compound assignment to the rhs operand and rounding variants of division.
Examples
use rug::ops::DivRoundingFrom; struct I(i32); impl DivRoundingFrom<i32> for I { fn div_trunc_from(&mut self, lhs: i32) { self.0 = lhs / self.0; } fn div_ceil_from(&mut self, lhs: i32) { let (q, r) = (lhs / self.0, lhs % self.0); let change = if self.0 > 0 { r > 0 } else { r < 0 }; self.0 = if change { q + 1 } else { q }; } fn div_floor_from(&mut self, lhs: i32) { let (q, r) = (lhs / self.0, lhs % self.0); let change = if self.0 > 0 { r < 0 } else { r > 0 }; self.0 = if change { q - 1 } else { q }; } fn div_euc_from(&mut self, lhs: i32) { let (q, r) = (lhs / self.0, lhs % self.0); self.0 = if r < 0 { if self.0 < 0 { q + 1 } else { q - 1 } } else { q }; } } let mut div_ceil = I(3); div_ceil.div_ceil_from(10); assert_eq!(div_ceil.0, 4);
Required Methods
fn div_trunc_from(&mut self, lhs: Lhs)
Performs division, rounding the quotient towards zero.
fn div_ceil_from(&mut self, lhs: Lhs)
Performs division, rounding the quotient up.
fn div_floor_from(&mut self, lhs: Lhs)
Performs division, rounding the quotient down.
fn div_euc_from(&mut self, lhs: Lhs)
Performs Euclidean division, rounding the quotient so that the remainder cannot be negative.
Implementations on Foreign Types
impl DivRoundingFrom for i8
[src]
impl DivRoundingFrom for i8
fn div_trunc_from(&mut self, lhs: i8)
[src]
fn div_trunc_from(&mut self, lhs: i8)
fn div_ceil_from(&mut self, lhs: i8)
[src]
fn div_ceil_from(&mut self, lhs: i8)
fn div_floor_from(&mut self, lhs: i8)
[src]
fn div_floor_from(&mut self, lhs: i8)
fn div_euc_from(&mut self, lhs: i8)
[src]
fn div_euc_from(&mut self, lhs: i8)
impl<'a> DivRoundingFrom<&'a i8> for i8
[src]
impl<'a> DivRoundingFrom<&'a i8> for i8
fn div_trunc_from(&mut self, lhs: &i8)
[src]
fn div_trunc_from(&mut self, lhs: &i8)
fn div_ceil_from(&mut self, lhs: &i8)
[src]
fn div_ceil_from(&mut self, lhs: &i8)
fn div_floor_from(&mut self, lhs: &i8)
[src]
fn div_floor_from(&mut self, lhs: &i8)
fn div_euc_from(&mut self, lhs: &i8)
[src]
fn div_euc_from(&mut self, lhs: &i8)
impl DivRoundingFrom for i16
[src]
impl DivRoundingFrom for i16
fn div_trunc_from(&mut self, lhs: i16)
[src]
fn div_trunc_from(&mut self, lhs: i16)
fn div_ceil_from(&mut self, lhs: i16)
[src]
fn div_ceil_from(&mut self, lhs: i16)
fn div_floor_from(&mut self, lhs: i16)
[src]
fn div_floor_from(&mut self, lhs: i16)
fn div_euc_from(&mut self, lhs: i16)
[src]
fn div_euc_from(&mut self, lhs: i16)
impl<'a> DivRoundingFrom<&'a i16> for i16
[src]
impl<'a> DivRoundingFrom<&'a i16> for i16
fn div_trunc_from(&mut self, lhs: &i16)
[src]
fn div_trunc_from(&mut self, lhs: &i16)
fn div_ceil_from(&mut self, lhs: &i16)
[src]
fn div_ceil_from(&mut self, lhs: &i16)
fn div_floor_from(&mut self, lhs: &i16)
[src]
fn div_floor_from(&mut self, lhs: &i16)
fn div_euc_from(&mut self, lhs: &i16)
[src]
fn div_euc_from(&mut self, lhs: &i16)
impl DivRoundingFrom for i32
[src]
impl DivRoundingFrom for i32
fn div_trunc_from(&mut self, lhs: i32)
[src]
fn div_trunc_from(&mut self, lhs: i32)
fn div_ceil_from(&mut self, lhs: i32)
[src]
fn div_ceil_from(&mut self, lhs: i32)
fn div_floor_from(&mut self, lhs: i32)
[src]
fn div_floor_from(&mut self, lhs: i32)
fn div_euc_from(&mut self, lhs: i32)
[src]
fn div_euc_from(&mut self, lhs: i32)
impl<'a> DivRoundingFrom<&'a i32> for i32
[src]
impl<'a> DivRoundingFrom<&'a i32> for i32
fn div_trunc_from(&mut self, lhs: &i32)
[src]
fn div_trunc_from(&mut self, lhs: &i32)
fn div_ceil_from(&mut self, lhs: &i32)
[src]
fn div_ceil_from(&mut self, lhs: &i32)
fn div_floor_from(&mut self, lhs: &i32)
[src]
fn div_floor_from(&mut self, lhs: &i32)
fn div_euc_from(&mut self, lhs: &i32)
[src]
fn div_euc_from(&mut self, lhs: &i32)
impl DivRoundingFrom for i64
[src]
impl DivRoundingFrom for i64
fn div_trunc_from(&mut self, lhs: i64)
[src]
fn div_trunc_from(&mut self, lhs: i64)
fn div_ceil_from(&mut self, lhs: i64)
[src]
fn div_ceil_from(&mut self, lhs: i64)
fn div_floor_from(&mut self, lhs: i64)
[src]
fn div_floor_from(&mut self, lhs: i64)
fn div_euc_from(&mut self, lhs: i64)
[src]
fn div_euc_from(&mut self, lhs: i64)
impl<'a> DivRoundingFrom<&'a i64> for i64
[src]
impl<'a> DivRoundingFrom<&'a i64> for i64
fn div_trunc_from(&mut self, lhs: &i64)
[src]
fn div_trunc_from(&mut self, lhs: &i64)
fn div_ceil_from(&mut self, lhs: &i64)
[src]
fn div_ceil_from(&mut self, lhs: &i64)
fn div_floor_from(&mut self, lhs: &i64)
[src]
fn div_floor_from(&mut self, lhs: &i64)
fn div_euc_from(&mut self, lhs: &i64)
[src]
fn div_euc_from(&mut self, lhs: &i64)
impl DivRoundingFrom for i128
[src]
impl DivRoundingFrom for i128
fn div_trunc_from(&mut self, lhs: i128)
[src]
fn div_trunc_from(&mut self, lhs: i128)
fn div_ceil_from(&mut self, lhs: i128)
[src]
fn div_ceil_from(&mut self, lhs: i128)
fn div_floor_from(&mut self, lhs: i128)
[src]
fn div_floor_from(&mut self, lhs: i128)
fn div_euc_from(&mut self, lhs: i128)
[src]
fn div_euc_from(&mut self, lhs: i128)
impl<'a> DivRoundingFrom<&'a i128> for i128
[src]
impl<'a> DivRoundingFrom<&'a i128> for i128
fn div_trunc_from(&mut self, lhs: &i128)
[src]
fn div_trunc_from(&mut self, lhs: &i128)
fn div_ceil_from(&mut self, lhs: &i128)
[src]
fn div_ceil_from(&mut self, lhs: &i128)
fn div_floor_from(&mut self, lhs: &i128)
[src]
fn div_floor_from(&mut self, lhs: &i128)
fn div_euc_from(&mut self, lhs: &i128)
[src]
fn div_euc_from(&mut self, lhs: &i128)
impl DivRoundingFrom for isize
[src]
impl DivRoundingFrom for isize
fn div_trunc_from(&mut self, lhs: isize)
[src]
fn div_trunc_from(&mut self, lhs: isize)
fn div_ceil_from(&mut self, lhs: isize)
[src]
fn div_ceil_from(&mut self, lhs: isize)
fn div_floor_from(&mut self, lhs: isize)
[src]
fn div_floor_from(&mut self, lhs: isize)
fn div_euc_from(&mut self, lhs: isize)
[src]
fn div_euc_from(&mut self, lhs: isize)
impl<'a> DivRoundingFrom<&'a isize> for isize
[src]
impl<'a> DivRoundingFrom<&'a isize> for isize
fn div_trunc_from(&mut self, lhs: &isize)
[src]
fn div_trunc_from(&mut self, lhs: &isize)
fn div_ceil_from(&mut self, lhs: &isize)
[src]
fn div_ceil_from(&mut self, lhs: &isize)
fn div_floor_from(&mut self, lhs: &isize)
[src]
fn div_floor_from(&mut self, lhs: &isize)
fn div_euc_from(&mut self, lhs: &isize)
[src]
fn div_euc_from(&mut self, lhs: &isize)
impl DivRoundingFrom for u8
[src]
impl DivRoundingFrom for u8
fn div_trunc_from(&mut self, lhs: u8)
[src]
fn div_trunc_from(&mut self, lhs: u8)
fn div_ceil_from(&mut self, lhs: u8)
[src]
fn div_ceil_from(&mut self, lhs: u8)
fn div_floor_from(&mut self, lhs: u8)
[src]
fn div_floor_from(&mut self, lhs: u8)
fn div_euc_from(&mut self, lhs: u8)
[src]
fn div_euc_from(&mut self, lhs: u8)
impl<'a> DivRoundingFrom<&'a u8> for u8
[src]
impl<'a> DivRoundingFrom<&'a u8> for u8
fn div_trunc_from(&mut self, lhs: &u8)
[src]
fn div_trunc_from(&mut self, lhs: &u8)
fn div_ceil_from(&mut self, lhs: &u8)
[src]
fn div_ceil_from(&mut self, lhs: &u8)
fn div_floor_from(&mut self, lhs: &u8)
[src]
fn div_floor_from(&mut self, lhs: &u8)
fn div_euc_from(&mut self, lhs: &u8)
[src]
fn div_euc_from(&mut self, lhs: &u8)
impl DivRoundingFrom for u16
[src]
impl DivRoundingFrom for u16
fn div_trunc_from(&mut self, lhs: u16)
[src]
fn div_trunc_from(&mut self, lhs: u16)
fn div_ceil_from(&mut self, lhs: u16)
[src]
fn div_ceil_from(&mut self, lhs: u16)
fn div_floor_from(&mut self, lhs: u16)
[src]
fn div_floor_from(&mut self, lhs: u16)
fn div_euc_from(&mut self, lhs: u16)
[src]
fn div_euc_from(&mut self, lhs: u16)
impl<'a> DivRoundingFrom<&'a u16> for u16
[src]
impl<'a> DivRoundingFrom<&'a u16> for u16
fn div_trunc_from(&mut self, lhs: &u16)
[src]
fn div_trunc_from(&mut self, lhs: &u16)
fn div_ceil_from(&mut self, lhs: &u16)
[src]
fn div_ceil_from(&mut self, lhs: &u16)
fn div_floor_from(&mut self, lhs: &u16)
[src]
fn div_floor_from(&mut self, lhs: &u16)
fn div_euc_from(&mut self, lhs: &u16)
[src]
fn div_euc_from(&mut self, lhs: &u16)
impl DivRoundingFrom for u32
[src]
impl DivRoundingFrom for u32
fn div_trunc_from(&mut self, lhs: u32)
[src]
fn div_trunc_from(&mut self, lhs: u32)
fn div_ceil_from(&mut self, lhs: u32)
[src]
fn div_ceil_from(&mut self, lhs: u32)
fn div_floor_from(&mut self, lhs: u32)
[src]
fn div_floor_from(&mut self, lhs: u32)
fn div_euc_from(&mut self, lhs: u32)
[src]
fn div_euc_from(&mut self, lhs: u32)
impl<'a> DivRoundingFrom<&'a u32> for u32
[src]
impl<'a> DivRoundingFrom<&'a u32> for u32
fn div_trunc_from(&mut self, lhs: &u32)
[src]
fn div_trunc_from(&mut self, lhs: &u32)
fn div_ceil_from(&mut self, lhs: &u32)
[src]
fn div_ceil_from(&mut self, lhs: &u32)
fn div_floor_from(&mut self, lhs: &u32)
[src]
fn div_floor_from(&mut self, lhs: &u32)
fn div_euc_from(&mut self, lhs: &u32)
[src]
fn div_euc_from(&mut self, lhs: &u32)
impl DivRoundingFrom for u64
[src]
impl DivRoundingFrom for u64
fn div_trunc_from(&mut self, lhs: u64)
[src]
fn div_trunc_from(&mut self, lhs: u64)
fn div_ceil_from(&mut self, lhs: u64)
[src]
fn div_ceil_from(&mut self, lhs: u64)
fn div_floor_from(&mut self, lhs: u64)
[src]
fn div_floor_from(&mut self, lhs: u64)
fn div_euc_from(&mut self, lhs: u64)
[src]
fn div_euc_from(&mut self, lhs: u64)
impl<'a> DivRoundingFrom<&'a u64> for u64
[src]
impl<'a> DivRoundingFrom<&'a u64> for u64
fn div_trunc_from(&mut self, lhs: &u64)
[src]
fn div_trunc_from(&mut self, lhs: &u64)
fn div_ceil_from(&mut self, lhs: &u64)
[src]
fn div_ceil_from(&mut self, lhs: &u64)
fn div_floor_from(&mut self, lhs: &u64)
[src]
fn div_floor_from(&mut self, lhs: &u64)
fn div_euc_from(&mut self, lhs: &u64)
[src]
fn div_euc_from(&mut self, lhs: &u64)
impl DivRoundingFrom for u128
[src]
impl DivRoundingFrom for u128
fn div_trunc_from(&mut self, lhs: u128)
[src]
fn div_trunc_from(&mut self, lhs: u128)
fn div_ceil_from(&mut self, lhs: u128)
[src]
fn div_ceil_from(&mut self, lhs: u128)
fn div_floor_from(&mut self, lhs: u128)
[src]
fn div_floor_from(&mut self, lhs: u128)
fn div_euc_from(&mut self, lhs: u128)
[src]
fn div_euc_from(&mut self, lhs: u128)
impl<'a> DivRoundingFrom<&'a u128> for u128
[src]
impl<'a> DivRoundingFrom<&'a u128> for u128
fn div_trunc_from(&mut self, lhs: &u128)
[src]
fn div_trunc_from(&mut self, lhs: &u128)
fn div_ceil_from(&mut self, lhs: &u128)
[src]
fn div_ceil_from(&mut self, lhs: &u128)
fn div_floor_from(&mut self, lhs: &u128)
[src]
fn div_floor_from(&mut self, lhs: &u128)
fn div_euc_from(&mut self, lhs: &u128)
[src]
fn div_euc_from(&mut self, lhs: &u128)
impl DivRoundingFrom for usize
[src]
impl DivRoundingFrom for usize
fn div_trunc_from(&mut self, lhs: usize)
[src]
fn div_trunc_from(&mut self, lhs: usize)
fn div_ceil_from(&mut self, lhs: usize)
[src]
fn div_ceil_from(&mut self, lhs: usize)
fn div_floor_from(&mut self, lhs: usize)
[src]
fn div_floor_from(&mut self, lhs: usize)
fn div_euc_from(&mut self, lhs: usize)
[src]
fn div_euc_from(&mut self, lhs: usize)
impl<'a> DivRoundingFrom<&'a usize> for usize
[src]
impl<'a> DivRoundingFrom<&'a usize> for usize
fn div_trunc_from(&mut self, lhs: &usize)
[src]
fn div_trunc_from(&mut self, lhs: &usize)
fn div_ceil_from(&mut self, lhs: &usize)
[src]
fn div_ceil_from(&mut self, lhs: &usize)
fn div_floor_from(&mut self, lhs: &usize)
[src]
fn div_floor_from(&mut self, lhs: &usize)
fn div_euc_from(&mut self, lhs: &usize)
[src]
fn div_euc_from(&mut self, lhs: &usize)
impl DivRoundingFrom for f32
[src]
impl DivRoundingFrom for f32
fn div_trunc_from(&mut self, lhs: f32)
[src]
fn div_trunc_from(&mut self, lhs: f32)
fn div_ceil_from(&mut self, lhs: f32)
[src]
fn div_ceil_from(&mut self, lhs: f32)
fn div_floor_from(&mut self, lhs: f32)
[src]
fn div_floor_from(&mut self, lhs: f32)
fn div_euc_from(&mut self, lhs: f32)
[src]
fn div_euc_from(&mut self, lhs: f32)
impl<'a> DivRoundingFrom<&'a f32> for f32
[src]
impl<'a> DivRoundingFrom<&'a f32> for f32
fn div_trunc_from(&mut self, lhs: &f32)
[src]
fn div_trunc_from(&mut self, lhs: &f32)
fn div_ceil_from(&mut self, lhs: &f32)
[src]
fn div_ceil_from(&mut self, lhs: &f32)
fn div_floor_from(&mut self, lhs: &f32)
[src]
fn div_floor_from(&mut self, lhs: &f32)
fn div_euc_from(&mut self, lhs: &f32)
[src]
fn div_euc_from(&mut self, lhs: &f32)
impl DivRoundingFrom for f64
[src]
impl DivRoundingFrom for f64
fn div_trunc_from(&mut self, lhs: f64)
[src]
fn div_trunc_from(&mut self, lhs: f64)
fn div_ceil_from(&mut self, lhs: f64)
[src]
fn div_ceil_from(&mut self, lhs: f64)
fn div_floor_from(&mut self, lhs: f64)
[src]
fn div_floor_from(&mut self, lhs: f64)
fn div_euc_from(&mut self, lhs: f64)
[src]
fn div_euc_from(&mut self, lhs: f64)
impl<'a> DivRoundingFrom<&'a f64> for f64
[src]
impl<'a> DivRoundingFrom<&'a f64> for f64
fn div_trunc_from(&mut self, lhs: &f64)
[src]
fn div_trunc_from(&mut self, lhs: &f64)
fn div_ceil_from(&mut self, lhs: &f64)
[src]
fn div_ceil_from(&mut self, lhs: &f64)
fn div_floor_from(&mut self, lhs: &f64)
[src]
fn div_floor_from(&mut self, lhs: &f64)
fn div_euc_from(&mut self, lhs: &f64)
[src]
fn div_euc_from(&mut self, lhs: &f64)