Additive

Trait Additive 

Source
pub trait Additive:
    Add<Output = Self>
    + AddAssign
    + PartialEq
    + Sized { }
Expand description

A trait for types that support addition (and comparison) operations.

This trait combines the basic requirements for types that can be added together:

  • Addition operation with Add trait
  • Addition assignment with AddAssign trait
  • Equality comparison with PartialEq

§Examples

  • All primitive numeric types implement this trait
  • Boolean type implements this trait using bitwise std::ops::BitXor
  • Using the modular! macro, you can define a modular arithmetic type and it will implement this trait.
  • Using the prime_field! macro, you can define a prime field type and it will implement this trait.

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 Additive for f32

Source§

impl Additive for f64

Source§

impl Additive for i8

Source§

impl Additive for i16

Source§

impl Additive for i32

Source§

impl Additive for i64

Source§

impl Additive for i128

Source§

impl Additive for isize

Source§

impl Additive for u8

Source§

impl Additive for u16

Source§

impl Additive for u32

Source§

impl Additive for u64

Source§

impl Additive for u128

Source§

impl Additive for usize

Implementors§

Source§

impl Additive for Boolean

Source§

impl<F> Additive for TropicalElement<F>
where F: Copy + Debug + PartialEq + PartialOrd + Add<Output = F> + Mul<Output = F> + Zero + One,

Source§

impl<F: Field + Copy + Debug, const N: usize> Additive for CliffordAlgebraElement<'_, F, N>
where [(); { _ }]:,

Source§

impl<F: Field + Copy> Additive for DynamicVector<F>

Source§

impl<R: Ring> Additive for TrivialModule<R>

Source§

impl<const M: usize, F: Field + Copy> Additive for FixedVector<M, F>