diff --git a/src/identities.rs b/src/identities.rs index 14f5ac0..0158a46 100644 --- a/src/identities.rs +++ b/src/identities.rs @@ -79,6 +79,14 @@ pub trait One: Sized + Mul { /// `static mut`s. // FIXME (#5527): This should be an associated constant fn one() -> Self; + + /// Returns `true` if `self` is equal to the multiplicative identity. + /// + /// Compatibility note: this method will be a requirement to implement in the future; new + /// implementors should provide it for future-compatibility. + fn is_one(&self) -> bool where Self: PartialEq { + *self == Self::one() + } } macro_rules! one_impl {