Arithmetic

Trait Arithmetic 

Source
pub trait Arithmetic:
    Sized
    + Add<Self, Output = Self>
    + for<'a> Add<&'a Self, Output = Self>
    + AddAssign
    + for<'a> AddAssign<&'a Self>
    + Sub<Output = Self>
    + for<'a> Sub<&'a Self, Output = Self>
    + SubAssign
    + for<'a> SubAssign<&'a Self>
    + Mul<Output = Self>
    + for<'a> Mul<&'a Self, Output = Self>
    + MulAssign
    + for<'a> MulAssign<&'a Self>
    + Div<Output = Self>
    + for<'a> Div<&'a Self, Output = Self>
    + DivAssign
    + for<'a> DivAssign<&'a Self>
    + Neg<Output = Self>
    + NegAssign
    + LowerExp { }
Expand description

A convenience trait that aggregates the standard arithmetic operations.

This trait bundles the common arithmetic operator traits from std::ops (e.g., Add, Sub, Mul, Div, and their *Assign variants) into a single super-trait. It is used as a bound on FpScalar to ensure all scalar types support basic arithmetic.

This trait does not require Copy. Instead, it explicitly requires that arithmetic operations are implemented for both owned values (Self) and references (&Self). This provides flexibility for both move and copy semantics, allowing implementors to avoid unnecessary clones in performance-sensitive code.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Arithmetic for f64

Marker implementation of Arithmetic for f64.

This signifies that f64 supports the standard arithmetic operations (addition, subtraction, multiplication, division, remainder, negation) as defined by the traits aggregated within Arithmetic.

Source§

impl Arithmetic for Complex<f64>

Marker implementation of Arithmetic for num::Complex<f64>.

This signifies that Complex<f64> supports the standard arithmetic operations (addition, subtraction, multiplication, division, negation) as defined by the traits aggregated within Arithmetic.

Implementors§