pub trait One: Sized + Mul<Self, Output = Self> {
    fn one() -> Self;

    fn set_one(&mut self) { ... }
    fn is_one(&self) -> bool
    where
        Self: PartialEq<Self>
, { ... } }
Expand description

Defines a multiplicative identity element for Self.

Laws

a * 1 = a       ∀ a ∈ Self
1 * a = a       ∀ a ∈ Self

Required Methods§

Returns 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§

Sets self to the multiplicative identity element of Self, 1.

Returns true if self is 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: PartialEq bound will be removed.

Implementations on Foreign Types§

Creates a new identity similarity.

Creates a new identity isometry.

Creates a new identity transform.

Implementors§

impl<Frac> One for FixedI8<Frac>where
    Frac: IsLessOrEqual<U6, Output = True> + LeEqU8,

impl<Frac> One for FixedI16<Frac>where
    Frac: IsLessOrEqual<U14, Output = True> + LeEqU16,

impl<Frac> One for FixedI32<Frac>where
    Frac: IsLessOrEqual<U30, Output = True> + LeEqU32,

impl<Frac> One for FixedI64<Frac>where
    Frac: IsLessOrEqual<U62, Output = True> + LeEqU64,

impl<Frac> One for FixedI128<Frac>where
    Frac: IsLessOrEqual<U126, Output = True> + LeEqU128,

impl<Frac> One for FixedU8<Frac>where
    Frac: IsLessOrEqual<U7, Output = True> + LeEqU8,

impl<Frac> One for FixedU16<Frac>where
    Frac: IsLessOrEqual<U15, Output = True> + LeEqU16,

impl<Frac> One for FixedU32<Frac>where
    Frac: IsLessOrEqual<U31, Output = True> + LeEqU32,

impl<Frac> One for FixedU64<Frac>where
    Frac: IsLessOrEqual<U63, Output = True> + LeEqU64,

impl<Frac> One for FixedU128<Frac>where
    Frac: IsLessOrEqual<U127, Output = True> + LeEqU128,