pub enum DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,{
S(T),
__H(G),
}
Expand description
The wrapper implementation
Keeps data within S (small) whenever possible, performing checked arithmetic and moving onto __H (huge) when overflows happen. Every math operation on __H performs a read of the resulting number with TryToConvertFrom::try_to_convert_from. Every math operation on S is checked for overflows.
Variants§
S(T)
Represents the small type, implementing Copy and allocated on stack. The wrapper tries to reduce contained values to this type whenever possible
__H(G)
Represents the huge type, implementing Clone. To be used when values overflow T
Implementations§
source§impl<T, G> DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
sourcepub fn unpack(self) -> Result<T, G>
pub fn unpack(self) -> Result<T, G>
Unpacks the value
Utilises Result::Ok for S(small) numbers and Result::Err for __H(huge) ones
§Examples
use fraction::dynaint::DynaInt;
type D = DynaInt<u8, u16>;
assert_eq!(Ok(1u8), D::from(1u8).unpack());
assert_eq!(Err(256u16), D::from(256u16).unpack());
Trait Implementations§
source§impl<'a, T, G> Add<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<'a, T, G> Add<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<'a, T, G> Add for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Add<Output = T> + CheckedAdd,
G: Clone + GenericInteger + Add<Output = G> + CheckedAdd,
&'a G: Add<G, Output = G> + Add<Output = G>,
impl<'a, T, G> Add for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Add<Output = T> + CheckedAdd,
G: Clone + GenericInteger + Add<Output = G> + CheckedAdd,
&'a G: Add<G, Output = G> + Add<Output = G>,
source§impl<T, G> Add for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Add<Output = T> + CheckedAdd,
G: Clone + GenericInteger + Add<Output = G> + CheckedAdd,
impl<T, G> Add for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Add<Output = T> + CheckedAdd,
G: Clone + GenericInteger + Add<Output = G> + CheckedAdd,
source§impl<'a, T, G> AddAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + AddAssign + CheckedAdd,
G: Clone + GenericInteger + AddAssign + CheckedAdd,
impl<'a, T, G> AddAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + AddAssign + CheckedAdd,
G: Clone + GenericInteger + AddAssign + CheckedAdd,
source§fn add_assign(&mut self, other: &'a Self)
fn add_assign(&mut self, other: &'a Self)
Performs the
+=
operation. Read moresource§impl<T, G> AddAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + AddAssign + CheckedAdd,
G: Clone + GenericInteger + AddAssign + CheckedAdd,
impl<T, G> AddAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + AddAssign + CheckedAdd,
G: Clone + GenericInteger + AddAssign + CheckedAdd,
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moresource§impl<'a, T, G> BitAnd for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAnd<Output = T>,
G: Clone + GenericInteger + BitAnd<Output = G> + BitAnd<&'a G, Output = G>,
&'a G: BitAnd<G, Output = G> + BitAnd<Output = G>,
impl<'a, T, G> BitAnd for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAnd<Output = T>,
G: Clone + GenericInteger + BitAnd<Output = G> + BitAnd<&'a G, Output = G>,
&'a G: BitAnd<G, Output = G> + BitAnd<Output = G>,
source§impl<T, G> BitAnd for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAnd<Output = T>,
G: Clone + GenericInteger + BitAnd<Output = G>,
impl<T, G> BitAnd for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAnd<Output = T>,
G: Clone + GenericInteger + BitAnd<Output = G>,
source§impl<'a, T, G> BitAndAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAndAssign<&'a T>,
G: Clone + GenericInteger + BitAndAssign<&'a G> + BitAndAssign<G>,
impl<'a, T, G> BitAndAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAndAssign<&'a T>,
G: Clone + GenericInteger + BitAndAssign<&'a G> + BitAndAssign<G>,
source§fn bitand_assign(&mut self, other: &'a Self)
fn bitand_assign(&mut self, other: &'a Self)
Performs the
&=
operation. Read moresource§impl<T, G> BitAndAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAndAssign,
G: Clone + GenericInteger + BitAndAssign,
impl<T, G> BitAndAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitAndAssign,
G: Clone + GenericInteger + BitAndAssign,
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Performs the
&=
operation. Read moresource§impl<'a, T, G> BitOr for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOr<Output = T>,
G: Clone + GenericInteger + BitOr<Output = G> + BitOr<&'a G, Output = G>,
&'a G: BitOr<G, Output = G> + BitOr<Output = G>,
impl<'a, T, G> BitOr for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOr<Output = T>,
G: Clone + GenericInteger + BitOr<Output = G> + BitOr<&'a G, Output = G>,
&'a G: BitOr<G, Output = G> + BitOr<Output = G>,
source§impl<T, G> BitOr for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOr<Output = T>,
G: Clone + GenericInteger + BitOr<Output = G>,
impl<T, G> BitOr for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOr<Output = T>,
G: Clone + GenericInteger + BitOr<Output = G>,
source§impl<'a, T, G> BitOrAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOrAssign<&'a T>,
G: Clone + GenericInteger + BitOrAssign<&'a G> + BitOrAssign<G>,
impl<'a, T, G> BitOrAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOrAssign<&'a T>,
G: Clone + GenericInteger + BitOrAssign<&'a G> + BitOrAssign<G>,
source§fn bitor_assign(&mut self, other: &'a Self)
fn bitor_assign(&mut self, other: &'a Self)
Performs the
|=
operation. Read moresource§impl<T, G> BitOrAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOrAssign,
G: Clone + GenericInteger + BitOrAssign,
impl<T, G> BitOrAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitOrAssign,
G: Clone + GenericInteger + BitOrAssign,
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Performs the
|=
operation. Read moresource§impl<'a, T, G> BitXor for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXor<Output = T>,
G: Clone + GenericInteger + BitXor<Output = G> + BitXor<&'a G, Output = G>,
&'a G: BitXor<G, Output = G> + BitXor<Output = G>,
impl<'a, T, G> BitXor for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXor<Output = T>,
G: Clone + GenericInteger + BitXor<Output = G> + BitXor<&'a G, Output = G>,
&'a G: BitXor<G, Output = G> + BitXor<Output = G>,
source§impl<T, G> BitXor for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXor<Output = T>,
G: Clone + GenericInteger + BitXor<Output = G>,
impl<T, G> BitXor for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXor<Output = T>,
G: Clone + GenericInteger + BitXor<Output = G>,
source§impl<'a, T, G> BitXorAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXorAssign<&'a T>,
G: Clone + GenericInteger + BitXorAssign<&'a G> + BitXorAssign<G>,
impl<'a, T, G> BitXorAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXorAssign<&'a T>,
G: Clone + GenericInteger + BitXorAssign<&'a G> + BitXorAssign<G>,
source§fn bitxor_assign(&mut self, other: &'a Self)
fn bitxor_assign(&mut self, other: &'a Self)
Performs the
^=
operation. Read moresource§impl<T, G> BitXorAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXorAssign,
G: Clone + GenericInteger + BitXorAssign,
impl<T, G> BitXorAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + BitXorAssign,
G: Clone + GenericInteger + BitXorAssign,
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Performs the
^=
operation. Read moresource§impl<T, G> Bounded for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Bounded,
G: Clone + GenericInteger + Bounded,
impl<T, G> Bounded for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Bounded,
G: Clone + GenericInteger + Bounded,
source§impl<T, G> CheckedAdd for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedAdd,
G: Clone + GenericInteger + CheckedAdd,
impl<T, G> CheckedAdd for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedAdd,
G: Clone + GenericInteger + CheckedAdd,
source§fn checked_add(&self, other: &Self) -> Option<Self>
fn checked_add(&self, other: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens,
None
is
returned.source§impl<T, G> CheckedDiv for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedDiv,
G: Clone + GenericInteger + CheckedDiv,
impl<T, G> CheckedDiv for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedDiv,
G: Clone + GenericInteger + CheckedDiv,
source§fn checked_div(&self, other: &Self) -> Option<Self>
fn checked_div(&self, other: &Self) -> Option<Self>
Divides two numbers, checking for underflow, overflow and division by
zero. If any of that happens,
None
is returned.source§impl<T, G> CheckedMul for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedMul,
G: Clone + GenericInteger + CheckedMul,
impl<T, G> CheckedMul for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedMul,
G: Clone + GenericInteger + CheckedMul,
source§fn checked_mul(&self, other: &Self) -> Option<Self>
fn checked_mul(&self, other: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens,
None
is returned.source§impl<T, G> CheckedSub for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedSub,
G: Clone + GenericInteger + CheckedSub,
impl<T, G> CheckedSub for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + CheckedSub,
G: Clone + GenericInteger + CheckedSub,
source§fn checked_sub(&self, other: &Self) -> Option<Self>
fn checked_sub(&self, other: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None
is returned.source§impl<T, G> Clone for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Clone,
G: Clone + GenericInteger + Clone,
impl<T, G> Clone for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Clone,
G: Clone + GenericInteger + Clone,
source§impl<T, G> Debug for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Debug,
G: Clone + GenericInteger + Debug,
impl<T, G> Debug for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Debug,
G: Clone + GenericInteger + Debug,
source§impl<T, G> Display for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Display,
G: Clone + GenericInteger + Display,
impl<T, G> Display for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Display,
G: Clone + GenericInteger + Display,
source§impl<'a, T, G> Div<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<'a, T, G> Div<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<'a, T, G> Div for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Div<Output = T> + CheckedDiv,
G: Clone + GenericInteger + Div<Output = G> + CheckedDiv,
&'a G: Div<G, Output = G> + Div<Output = G>,
impl<'a, T, G> Div for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Div<Output = T> + CheckedDiv,
G: Clone + GenericInteger + Div<Output = G> + CheckedDiv,
&'a G: Div<G, Output = G> + Div<Output = G>,
source§impl<T, G> Div for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Div<Output = T> + CheckedDiv,
G: Clone + GenericInteger + Div<Output = G> + CheckedDiv,
impl<T, G> Div for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Div<Output = T> + CheckedDiv,
G: Clone + GenericInteger + Div<Output = G> + CheckedDiv,
source§impl<'a, T, G> DivAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + DivAssign + CheckedDiv,
G: Clone + GenericInteger + DivAssign + CheckedDiv,
impl<'a, T, G> DivAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + DivAssign + CheckedDiv,
G: Clone + GenericInteger + DivAssign + CheckedDiv,
source§fn div_assign(&mut self, other: &'a Self)
fn div_assign(&mut self, other: &'a Self)
Performs the
/=
operation. Read moresource§impl<T, G> DivAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + DivAssign + CheckedDiv,
G: Clone + GenericInteger + DivAssign + CheckedDiv,
impl<T, G> DivAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + DivAssign + CheckedDiv,
G: Clone + GenericInteger + DivAssign + CheckedDiv,
source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/=
operation. Read moresource§impl<T, G> From<BigUint> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger + From<BigUint>,
impl<T, G> From<BigUint> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger + From<BigUint>,
source§impl<T, G> From<DynaInt<T, G>> for BigUintwhere
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger + Into<BigUint>,
impl<T, G> From<DynaInt<T, G>> for BigUintwhere
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger + Into<BigUint>,
source§impl<T, G> From<u128> for DynaInt<T, G>where
u128: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> From<u128> for DynaInt<T, G>where
u128: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<T, G> From<u16> for DynaInt<T, G>where
u16: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> From<u16> for DynaInt<T, G>where
u16: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<T, G> From<u32> for DynaInt<T, G>where
u32: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> From<u32> for DynaInt<T, G>where
u32: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<T, G> From<u64> for DynaInt<T, G>where
u64: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> From<u64> for DynaInt<T, G>where
u64: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<T, G> From<u8> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> From<u8> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<T, G> From<usize> for DynaInt<T, G>where
usize: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> From<usize> for DynaInt<T, G>where
usize: GenericInteger + PartialOrd + Into<G>,
T: GenericInteger + Copy + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<T, G> GenericInteger for DynaInt<T, G>where
T: GenericInteger + Copy + Integer + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger + 'static,
impl<T, G> GenericInteger for DynaInt<T, G>where
T: GenericInteger + Copy + Integer + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger + 'static,
source§fn get_signed_value(self) -> (Sign, Self)
fn get_signed_value(self) -> (Sign, Self)
Returns the sign and the value itself.
Zero values must have Sign::Plus
source§impl<T, G> Integer for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> Integer for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§fn divides(&self, other: &Self) -> bool
fn divides(&self, other: &Self) -> bool
👎Deprecated: Please use is_multiple_of instead
Deprecated, use
is_multiple_of
instead.source§fn is_multiple_of(&self, other: &Self) -> bool
fn is_multiple_of(&self, other: &Self) -> bool
source§fn div_rem(&self, other: &Self) -> (Self, Self)
fn div_rem(&self, other: &Self) -> (Self, Self)
Simultaneous truncated integer division and modulus.
Returns
(quotient, remainder)
. Read moresource§fn gcd_lcm(&self, other: &Self) -> (Self, Self)
fn gcd_lcm(&self, other: &Self) -> (Self, Self)
Greatest Common Divisor (GCD) and
Lowest Common Multiple (LCM) together. Read more
source§fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>where
Self: Clone,
fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>where
Self: Clone,
Greatest common divisor and Bézout coefficients. Read more
source§fn div_mod_floor(&self, other: &Self) -> (Self, Self)
fn div_mod_floor(&self, other: &Self) -> (Self, Self)
Simultaneous floored integer division and modulus.
Returns
(quotient, remainder)
. Read moresource§fn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Rounds up to nearest multiple of argument. Read more
source§fn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Rounds down to nearest multiple of argument. Read more
source§impl<'a, T, G> Mul<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<'a, T, G> Mul<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<'a, T, G> Mul for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Mul<Output = T> + CheckedMul,
G: Clone + GenericInteger + Mul<Output = G> + CheckedMul,
&'a G: Mul<G, Output = G> + Mul<Output = G>,
impl<'a, T, G> Mul for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Mul<Output = T> + CheckedMul,
G: Clone + GenericInteger + Mul<Output = G> + CheckedMul,
&'a G: Mul<G, Output = G> + Mul<Output = G>,
source§impl<T, G> Mul for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Mul<Output = T> + CheckedMul,
G: Clone + GenericInteger + Mul<Output = G> + CheckedMul,
impl<T, G> Mul for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Mul<Output = T> + CheckedMul,
G: Clone + GenericInteger + Mul<Output = G> + CheckedMul,
source§impl<'a, T, G> MulAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + MulAssign + CheckedMul,
G: Clone + GenericInteger + MulAssign + CheckedMul,
impl<'a, T, G> MulAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + MulAssign + CheckedMul,
G: Clone + GenericInteger + MulAssign + CheckedMul,
source§fn mul_assign(&mut self, other: &'a Self)
fn mul_assign(&mut self, other: &'a Self)
Performs the
*=
operation. Read moresource§impl<T, G> MulAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + MulAssign + CheckedMul,
G: Clone + GenericInteger + MulAssign + CheckedMul,
impl<T, G> MulAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + MulAssign + CheckedMul,
G: Clone + GenericInteger + MulAssign + CheckedMul,
source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*=
operation. Read moresource§impl<T, G> Neg for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Neg<Output = T>,
G: Clone + GenericInteger + Neg<Output = G>,
impl<T, G> Neg for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Neg<Output = T>,
G: Clone + GenericInteger + Neg<Output = G>,
source§impl<T, G> Not for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Not<Output = T>,
G: Clone + GenericInteger + Not<Output = G>,
impl<T, G> Not for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Not<Output = T>,
G: Clone + GenericInteger + Not<Output = G>,
source§impl<T, G> Num for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Num,
G: Clone + GenericInteger,
impl<T, G> Num for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Num,
G: Clone + GenericInteger,
type FromStrRadixErr = <G as Num>::FromStrRadixErr
source§fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically
2..=36
). Read moresource§impl<T, G> One for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> One for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<T, G> Ord for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Ord,
G: Clone + GenericInteger + Ord,
impl<T, G> Ord for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Ord,
G: Clone + GenericInteger + Ord,
source§impl<T, G> PartialEq for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + PartialEq,
G: Clone + GenericInteger + PartialEq,
impl<T, G> PartialEq for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + PartialEq,
G: Clone + GenericInteger + PartialEq,
source§impl<T, G> PartialOrd for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + PartialOrd,
G: Clone + GenericInteger + PartialOrd,
impl<T, G> PartialOrd for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + PartialOrd,
G: Clone + GenericInteger + PartialOrd,
source§impl<'a, T, G> Rem<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<'a, T, G> Rem<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<'a, T, G> Rem for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Rem<Output = T>,
G: Clone + GenericInteger + Rem<Output = G>,
&'a G: Rem<G, Output = G> + Rem<Output = G>,
impl<'a, T, G> Rem for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Rem<Output = T>,
G: Clone + GenericInteger + Rem<Output = G>,
&'a G: Rem<G, Output = G> + Rem<Output = G>,
source§impl<T, G> Rem for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Rem<Output = T>,
G: Clone + GenericInteger + Rem<Output = G>,
impl<T, G> Rem for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Rem<Output = T>,
G: Clone + GenericInteger + Rem<Output = G>,
source§impl<'a, T, G> RemAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<'a, T, G> RemAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§fn rem_assign(&mut self, other: &'a Self)
fn rem_assign(&mut self, other: &'a Self)
Performs the
%=
operation. Read moresource§impl<T, G> RemAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + RemAssign,
G: Clone + GenericInteger + RemAssign,
impl<T, G> RemAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + RemAssign,
G: Clone + GenericInteger + RemAssign,
source§fn rem_assign(&mut self, other: Self)
fn rem_assign(&mut self, other: Self)
Performs the
%=
operation. Read moresource§impl<'a, T, G> Shl for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shl<Output = T>,
G: Clone + GenericInteger + Shl<Output = G> + Shl<&'a G, Output = G>,
&'a G: Shl<G, Output = G> + Shl<Output = G>,
impl<'a, T, G> Shl for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shl<Output = T>,
G: Clone + GenericInteger + Shl<Output = G> + Shl<&'a G, Output = G>,
&'a G: Shl<G, Output = G> + Shl<Output = G>,
source§impl<T, G> Shl for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shl<Output = T>,
G: Clone + GenericInteger + Shl<Output = G>,
impl<T, G> Shl for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shl<Output = T>,
G: Clone + GenericInteger + Shl<Output = G>,
source§impl<'a, T, G> ShlAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShlAssign<&'a T>,
G: Clone + GenericInteger + ShlAssign<&'a G> + ShlAssign<G>,
impl<'a, T, G> ShlAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShlAssign<&'a T>,
G: Clone + GenericInteger + ShlAssign<&'a G> + ShlAssign<G>,
source§fn shl_assign(&mut self, other: &'a Self)
fn shl_assign(&mut self, other: &'a Self)
Performs the
<<=
operation. Read moresource§impl<T, G> ShlAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShlAssign,
G: Clone + GenericInteger + ShlAssign,
impl<T, G> ShlAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShlAssign,
G: Clone + GenericInteger + ShlAssign,
source§fn shl_assign(&mut self, other: Self)
fn shl_assign(&mut self, other: Self)
Performs the
<<=
operation. Read moresource§impl<'a, T, G> Shr for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shr<Output = T>,
G: Clone + GenericInteger + Shr<Output = G> + Shr<&'a G, Output = G>,
&'a G: Shr<G, Output = G> + Shr<Output = G>,
impl<'a, T, G> Shr for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shr<Output = T>,
G: Clone + GenericInteger + Shr<Output = G> + Shr<&'a G, Output = G>,
&'a G: Shr<G, Output = G> + Shr<Output = G>,
source§impl<T, G> Shr for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shr<Output = T>,
G: Clone + GenericInteger + Shr<Output = G>,
impl<T, G> Shr for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Shr<Output = T>,
G: Clone + GenericInteger + Shr<Output = G>,
source§impl<'a, T, G> ShrAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShrAssign<&'a T>,
G: Clone + GenericInteger + ShrAssign<&'a G> + ShrAssign<G>,
impl<'a, T, G> ShrAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShrAssign<&'a T>,
G: Clone + GenericInteger + ShrAssign<&'a G> + ShrAssign<G>,
source§fn shr_assign(&mut self, other: &'a Self)
fn shr_assign(&mut self, other: &'a Self)
Performs the
>>=
operation. Read moresource§impl<T, G> ShrAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShrAssign,
G: Clone + GenericInteger + ShrAssign,
impl<T, G> ShrAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ShrAssign,
G: Clone + GenericInteger + ShrAssign,
source§fn shr_assign(&mut self, other: Self)
fn shr_assign(&mut self, other: Self)
Performs the
>>=
operation. Read moresource§impl<'a, T, G> Sub<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<'a, T, G> Sub<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
source§impl<'a, T, G> Sub for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Sub<Output = T> + CheckedSub,
G: Clone + GenericInteger + Sub<Output = G> + CheckedSub,
&'a G: Sub<G, Output = G> + Sub<Output = G>,
impl<'a, T, G> Sub for &'a DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Sub<Output = T> + CheckedSub,
G: Clone + GenericInteger + Sub<Output = G> + CheckedSub,
&'a G: Sub<G, Output = G> + Sub<Output = G>,
source§impl<T, G> Sub for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Sub<Output = T> + CheckedSub,
G: Clone + GenericInteger + Sub<Output = G> + CheckedSub,
impl<T, G> Sub for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Sub<Output = T> + CheckedSub,
G: Clone + GenericInteger + Sub<Output = G> + CheckedSub,
source§impl<'a, T, G> SubAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + SubAssign + CheckedSub,
G: Clone + GenericInteger + SubAssign + CheckedSub,
impl<'a, T, G> SubAssign<&'a DynaInt<T, G>> for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + SubAssign + CheckedSub,
G: Clone + GenericInteger + SubAssign + CheckedSub,
source§fn sub_assign(&mut self, other: &'a Self)
fn sub_assign(&mut self, other: &'a Self)
Performs the
-=
operation. Read moresource§impl<T, G> SubAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + SubAssign + CheckedSub,
G: Clone + GenericInteger + SubAssign + CheckedSub,
impl<T, G> SubAssign for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + SubAssign + CheckedSub,
G: Clone + GenericInteger + SubAssign + CheckedSub,
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read moresource§impl<T, G> ToBigInt for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ToBigInt,
G: Clone + GenericInteger + ToBigInt,
impl<T, G> ToBigInt for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ToBigInt,
G: Clone + GenericInteger + ToBigInt,
source§impl<T, G> ToBigUint for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ToBigUint,
G: Clone + GenericInteger + ToBigUint,
impl<T, G> ToBigUint for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ToBigUint,
G: Clone + GenericInteger + ToBigUint,
source§impl<T, G> ToPrimitive for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ToPrimitive,
G: Clone + GenericInteger,
impl<T, G> ToPrimitive for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + ToPrimitive,
G: Clone + GenericInteger,
source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
Converts the value of
self
to an i64
. If the value cannot be
represented by an i64
, then None
is returned.source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
Converts the value of
self
to a u64
. If the value cannot be
represented by a u64
, then None
is returned.source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
Converts the value of
self
to an isize
. If the value cannot be
represented by an isize
, then None
is returned.source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
Converts the value of
self
to an i8
. If the value cannot be
represented by an i8
, then None
is returned.source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
Converts the value of
self
to an i16
. If the value cannot be
represented by an i16
, then None
is returned.source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
Converts the value of
self
to an i32
. If the value cannot be
represented by an i32
, then None
is returned.source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
Converts the value of
self
to an i128
. If the value cannot be
represented by an i128
(i64
under the default implementation), then
None
is returned. Read moresource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
Converts the value of
self
to a usize
. If the value cannot be
represented by a usize
, then None
is returned.source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
Converts the value of
self
to a u8
. If the value cannot be
represented by a u8
, then None
is returned.source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
Converts the value of
self
to a u16
. If the value cannot be
represented by a u16
, then None
is returned.source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
Converts the value of
self
to a u32
. If the value cannot be
represented by a u32
, then None
is returned.source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
Converts the value of
self
to a u128
. If the value cannot be
represented by a u128
(u64
under the default implementation), then
None
is returned. Read moresource§impl<T, G> Zero for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> Zero for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Clone + GenericInteger,
impl<T, G> Copy for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8>,
G: Copy + GenericInteger,
impl<T, G> Eq for DynaInt<T, G>where
T: Copy + GenericInteger + Into<G> + TryToConvertFrom<G> + From<u8> + Eq,
G: Clone + GenericInteger + Eq,
Auto Trait Implementations§
impl<T, G> Freeze for DynaInt<T, G>
impl<T, G> RefUnwindSafe for DynaInt<T, G>where
T: RefUnwindSafe,
G: RefUnwindSafe,
impl<T, G> Send for DynaInt<T, G>
impl<T, G> Sync for DynaInt<T, G>
impl<T, G> Unpin for DynaInt<T, G>
impl<T, G> UnwindSafe for DynaInt<T, G>where
T: UnwindSafe,
G: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)