Struct arithmetic_eval::arith::ModularArithmetic
source · pub struct ModularArithmetic<T> { /* private fields */ }
Expand description
Modular arithmetic on integers.
As an example, ModularArithmetic<T>
implements Arithmetic<T>
if T
is one of unsigned
built-in integer types (u8
, u16
, u32
, u64
; u128
is excluded because it cannot be
extended to double width).
Implementations§
Trait Implementations§
source§impl Arithmetic<BigUint> for ModularArithmetic<BigUint>
impl Arithmetic<BigUint> for ModularArithmetic<BigUint>
source§fn add(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
fn add(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
Adds two values. Read more
source§fn sub(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
fn sub(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
Subtracts two values. Read more
source§fn mul(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
fn mul(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
Multiplies two values. Read more
source§fn div(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
fn div(&self, x: BigUint, y: BigUint) -> Result<BigUint, ArithmeticError>
Divides two values. Read more
source§impl<T> Arithmetic<T> for ModularArithmetic<T>
impl<T> Arithmetic<T> for ModularArithmetic<T>
source§impl<T: Clone> Clone for ModularArithmetic<T>
impl<T: Clone> Clone for ModularArithmetic<T>
source§fn clone(&self) -> ModularArithmetic<T>
fn clone(&self) -> ModularArithmetic<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for ModularArithmetic<T>
impl<T: Debug> Debug for ModularArithmetic<T>
impl<T: Copy> Copy for ModularArithmetic<T>
Auto Trait Implementations§
impl<T> Freeze for ModularArithmetic<T>where
T: Freeze,
impl<T> RefUnwindSafe for ModularArithmetic<T>where
T: RefUnwindSafe,
impl<T> Send for ModularArithmetic<T>where
T: Send,
impl<T> Sync for ModularArithmetic<T>where
T: Sync,
impl<T> Unpin for ModularArithmetic<T>where
T: Unpin,
impl<T> UnwindSafe for ModularArithmetic<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T, A> ArithmeticExt<T> for Awhere
A: Arithmetic<T>,
impl<T, A> ArithmeticExt<T> for Awhere
A: Arithmetic<T>,
source§fn without_comparisons(self) -> FullArithmetic<T, Self>
fn without_comparisons(self) -> FullArithmetic<T, Self>
Combines this arithmetic with a comparison function that assumes any two values are
incomparable.
source§fn with_natural_comparison(self) -> FullArithmetic<T, Self>where
T: PartialOrd,
fn with_natural_comparison(self) -> FullArithmetic<T, Self>where
T: PartialOrd,
Combines this arithmetic with a comparison function specified by the
PartialOrd
implementation for T
.source§fn with_comparison(
self,
comparison: fn(_: &T, _: &T) -> Option<Ordering>,
) -> FullArithmetic<T, Self>
fn with_comparison( self, comparison: fn(_: &T, _: &T) -> Option<Ordering>, ) -> FullArithmetic<T, Self>
Combines this arithmetic with the specified comparison function.
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)