Trait One
trait One: Sized + Mul<Self, Output = Self>
Defines a multiplicative identity element for Self.
Laws
a * 1 = a ∀ a ∈ Self
1 * a = a ∀ a ∈ Self
Required Methods
fn one() -> SelfReturns the multiplicative identity element of
Self,1.Purity
This function should return the same result at all times regardless of external mutable state, for example values stored in TLS or in
static muts.
Provided Methods
fn set_one(self: &mut Self)Sets
selfto the multiplicative identity element ofSelf,1.fn is_one(self: &Self) -> bool where Self: PartialEqReturns
trueifselfis equal to the multiplicative identity.For performance reasons, it's best to implement this manually. After a semver bump, this method will be required, and the
where Self: PartialEqbound will be removed.
Implementors
impl One for u32impl One for i16impl One for f64impl One for u16impl One for i8impl One for f32impl One for u8impl One for isizeimpl One for i128impl One for usizeimpl One for u128impl One for i64impl One for u64impl One for i32impl<T: One> One for Wrapping<T>