Trait num_traits::identities::One[][src]

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

    fn is_one(&self) -> bool
        Self: PartialEq
, { ... } }

Defines a multiplicative identity element for Self.

Required Methods

Returns the multiplicative identity element of Self, 1.


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


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

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

impl One for usize

impl One for u8

impl One for u16

impl One for u32

impl One for u64

impl One for u128

impl One for isize

impl One for i8

impl One for i16

impl One for i32

impl One for i64

impl One for i128

impl One for f32

impl One for f64

impl<T: One> One for Wrapping<T> where
    Wrapping<T>: Mul<Output = Wrapping<T>>,