pub trait InvMonoid:
MulMonoid
+ Div<Output = Self>
+ DivAssign {
// Required method
fn inverse(&self) -> Self;
}Expand description
Represents a Multiplicative Monoid with the additional property that every element has a multiplicative inverse.
This trait effectively defines the “inverse” operation within a multiplicative
context, sitting between MulMonoid and MulGroup in the hierarchy.
§Mathematical Definition
An InvMonoid is a MulMonoid where for every element a, there exists
an element a⁻¹ such that a * a⁻¹ = 1 and a⁻¹ * a = 1.
§Justification for Deviation (for floating-point types)
In pure mathematics, the zero element does not have a multiplicative inverse.
To align with standard floating-point behavior (IEEE 754), implementations
for types that can be zero (like f32, f64) should handle this case
gracefully by returning Infinity or NaN rather than panicking.
Required Methods§
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.