Expand description
Provides a wrapper for integer types with modular arithmetic behaviour.
Since modular arithmetic is commonly used with a specific prime modulus, this crate removes the cost of storing the modulus by hardcoding it in the definition and generating definitions with a macro, enhancing performance.
This also automatically moves modulus equality checking (because values of different modulo cannot be added directly) from runtime to compile time, enhancing stability.
Macros§
- def_
modular - This macro generates a struct that implements
Modular
.
Structs§
- Example
Modular101 - This struct is an example struct used to demonstrate what is generated by the
def_modular
macro.
Traits§
- Modular
- The Modular trait is implemented by all modular-arithmetic-defining classes.