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
Addtrait - Addition assignment with
AddAssigntrait - Equality comparison with
PartialEq
§Examples
- All primitive numeric types implement this trait
Booleantype implements this trait using bitwisestd::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.